NPE on using result of getErrorStream()
Closed this issue · 6 comments
mrezin commented
This line throws NPE because java.net.HttpURLConnection.getErrorStream() returns null.
mslipper commented
Will take a look at this tonight.
mrezin commented
It happens when client receives timeout exception.
private int readTimeoutMillis = 60 * 1000 * 2;
Steps to reproduce:
- Establish connection to the server
- Suspend corresponding thread on the server
- Invoke method and wait for the timeout (java.io.IOException: Connection timed out)
- Catch (IOException) block calls getErrorStream() and receives null which leads to NPE
mslipper commented
Got it, thanks. Should have a PR out later this evening.
mslipper commented
@mrezin PR up. Thanks for finding this. If you would be kind enough to pitch in reviewing the PR I'd be very grateful.
mrezin commented
Sure, I'd be happy to review the PR