IOException is swallowed as a result of JDK class behavior
jeff303 opened this issue · comments
There appears to be an oddity in the behavior of sun.nio.cs.StreamDecoder
, such that an IOException
thrown from its underlying input stream's available
method is silently swallowed. I will copy the relevant details from the jdk-dev mailing list post to here.
We are dealing with an issue where an underlying exception appears to be getting swallowed by the StreamDecoder
class. In particular, the Jersey client library we are using - 2.25.1
- is throwing an IOException
out of its implementation of InputStream#available
(apparently when an RST
packet is received from the peer terminating the connection). Specifically here by way of calling checkThrowable.
The caller of that is ultimately StreamDecoder#inReady
. We are seeing the problem under Oracle JDK 1.8.0_121
, but it seems the StreamDecoder code hasn't changed in a while, as seen here.
Full stack trace image here. Is there any way in which Jersey can, or should, change its behavior so that this exception isn't swallowed? I realize that the ultimate issue appears to be within the JDK code, but nonetheless, the exception being lost is a problem. Any other suggestions are welcomed!