1

我正在尝试解析来自 Apache HttpClient (3.1) 响应的响应,如下所示:

try {  
    int code = mclient.executeMethod(method);
    if (code == Status.OK.getCode()) {
        st = method.getResponseBodyAsStream();
        XMLBean el = doSomething(st);
        return el;
    }
} catch (HttpException e) {
    e.printStackTrace();
} catch (IOException e) {
    e.printStackTrace();
} finally {
    method.releaseConnection();
}

在使用原子解析器解析响应时,这给了我以下异常。

org.apache.abdera.parser.ParseException: java.lang.RuntimeException: [was class java.io.IOException] Attempted read on closed stream.

finally 块实际上关闭了连接。什么可能导致此关闭流错误?

SEVERE: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
org.apache.abdera.parser.ParseException: java.lang.RuntimeException: [was class java.io.IOException] Attempted read on closed stream.
    at org.apache.abdera.parser.stax.FOMBuilder.next(FOMBuilder.java:244)
    at org.apache.axiom.om.impl.llom.OMElementImpl.getNextOMSibling(OMElementImpl.java:337)
    at org.apache.axiom.om.impl.traverse.OMChildrenQNameIterator.next(OMChildrenQNameIterator.java:118)
    at org.apache.axiom.om.impl.llom.OMElementImpl.getFirstChildWithName(OMElementImpl.java:275)
    at org.apache.abdera.parser.stax.FOMElement.getFirstChild(FOMElement.java:180)
4

0 回答 0