我正在创建一个用于下载项目的类。我使用以下方法连接并检索下载信息:
public mDownload(String url) throws MalformedURLException {
this.url = new URL(url);
}
private void connect() throws IOException {
connection = url.openConnection();
date = connection.getDate();
--> expiration = connection.getExpiration();
length = connection.getContentLength();
lastModified = connection.getLastModified();
}
但我有一些关于部队在
-->
线坠毁的报告:java.lang.IllegalStateException: getInputStream() is not available. Is this a reentrant call?
at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:524)
at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHeaderField(HttpURLConnectionImpl.java:464)
at java.net.URLConnection.getHeaderFieldDate(URLConnection.java:548)
at java.net.HttpURLConnection.getHeaderFieldDate(HttpURLConnection.java:702)
at java.net.URLConnection.getExpiration(URLConnection.java:426)
为什么会发生这种错误,我该如何避免?谢谢!
最佳答案
查看this commit,这可能是一个糟糕的异常消息。可能是响应未能返回任何数据。您可以通过监视实际网络流量来确认。
关于java - IllegalStateException:getInputStream()不可用。这是可重入电话吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12391915/