gpt4 book ai didi

java - IllegalStateException : getInputStream() is not available. 这是可重入调用吗?

转载 作者:塔克拉玛干 更新时间:2023-11-01 19:11:31 24 4
gpt4 key购买 nike

我正在创建一个用于下载项目的类。我使用以下方法连接和检索下载信息:

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() is not available. 这是可重入调用吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12391915/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com