artiya4u / google-http-java-client

Automatically exported from code.google.com/p/google-http-java-client
0 stars 0 forks source link

Log message causes crash in HttpRequest #144

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Version of google-http-java-client:
1.10.3 Beta

Java environment:
Android 4.1 (Google Nexus)

Describe the problem.
For some weird reason I still have to investigate, in some occasions the 
HttpsURLConnectionImpl class in Android is causing its getResponseCode() method 
to throw a 'null' exception.

If the HttpRequest is executed with setRetryOnExecuteIOException(true) and with 
a UnsuccessfulResponseHandler set, a log message at line HttpRequest:912 is 
causing the request to throw a NullPointerException instead of effectively 
calling the response handler.
The line is the following:
logger.log(Level.WARNING, e.getMessage(), e);

How would you expect it to be fixed?
In a fail-over instinct excess, I'd say to check against the exception nullity:
logger.log(Level.WARNING, (e != null) ? e.getMessage() : "null IOException", e);

Original issue reported on code.google.com by fas...@gmail.com on 27 Jul 2012 at 10:40

GoogleCodeExporter commented 9 years ago

Original comment by rmis...@google.com on 27 Jul 2012 at 11:09

GoogleCodeExporter commented 9 years ago
http://codereview.appspot.com/6461103/

I don't understand how e could be null, but then again calling e.getMessage() 
doesn't make sense either.

Original comment by yan...@google.com on 20 Aug 2012 at 7:41

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 20 Aug 2012 at 8:27