Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2726] Android: NPE when receiving HTTP 204 response

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:59:55.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.6.0 M01
ComponentsAndroid
Labelsandroid, defect, release-1.6.0, reported-1.5.0
ReporterNathaniel McCallum
AssigneeDon Thorp
Created2011-04-15T03:27:57.000+0000
Updated2011-04-17T01:59:55.000+0000

Description

E/TiHttpClient( 4853): (TiHttpClient-7) [1,2314522] HTTP Error (java.lang.NullPointerException): java.lang.NullPointerException
E/TiHttpClient( 4853): java.lang.NullPointerException
E/TiHttpClient( 4853): at ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.handleResponse(TiHTTPClient.java:209)
E/TiHttpClient( 4853): at ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.handleResponse(TiHTTPClient.java:165)
E/TiHttpClient( 4853): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:657)
E/TiHttpClient( 4853): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:637)
E/TiHttpClient( 4853): at ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:997)
E/TiHttpClient( 4853): at java.lang.Thread.run(Thread.java:1096)
I/TiHttpClient( 4853): (TiHttpClient-7) [2,2314524] Sending error java.lang.NullPointerException

Comments

  1. Jeff Haynie 2011-04-15

    (from [cafb4fe6e7445043fea61bd846bdfdba8a533311]) [#2726] Handle when there is no entity; fixed-in-qa https://github.com/appcelerator/titanium_mobile/commit/cafb4fe6e7445043fea61bd846bdfdba8a533311"> https://github.com/appcelerator/titanium_mobile/commit/cafb4fe6e744...

  2. Anthony Webb 2011-04-15

    Did you find that this is only for 204's? I am seeing NPE coming back on 200's too? I am using the 1.6 nightly from Jan 6.

    [TRACE] E/TiUIView( 1729): (main) [5383,101697] TAP, TAP, TAP on [Ti.UI.Button] [TRACE] D/TiHttpClient( 1729): (kroll$3) [10,101707] Setting ready state to 1 [TRACE] D/dalvikvm( 1729): GC_FOR_MALLOC freed 12700 objects / 611088 bytes in 124ms [TRACE] D/dalvikvm( 1729): GC_FOR_MALLOC freed 1967 objects / 297312 bytes in 369ms [TRACE] D/TiHttpClient( 1729): (TiHttpClient-2) [2521,104228] Setting ready state to 2 [TRACE] D/TiHttpClient( 1729): (TiHttpClient-2) [0,104228] Setting ready state to 3 [TRACE] E/TiHttpClient( 1729): (TiHttpClient-2) [2,104230] HTTP Error (java.lang.NullPointerException): java.lang.NullPointerException [TRACE] E/TiHttpClient( 1729): java.lang.NullPointerException [TRACE] E/TiHttpClient( 1729): at ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.finishedReceivingEntityData(TiHTTPClient.java:321) [TRACE] E/TiHttpClient( 1729): at ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.handleResponse(TiHTTPClient.java:257) [TRACE] E/TiHttpClient( 1729): at ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.handleResponse(TiHTTPClient.java:166) [TRACE] E/TiHttpClient( 1729): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:657) [TRACE] E/TiHttpClient( 1729): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:637) [TRACE] E/TiHttpClient( 1729): at ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1010) [TRACE] E/TiHttpClient( 1729): at java.lang.Thread.run(Thread.java:1096) [TRACE] I/TiHttpClient( 1729): (TiHttpClient-2) [3,104233] Sending error java.lang.NullPointerException

  3. Anthony Webb 2011-04-15

    Sorry, let me format that right:

       [TRACE] E/TiUIView( 1729): (main) [5383,101697] TAP, TAP, TAP on [Ti.UI.Button]
       [TRACE] D/TiHttpClient( 1729): (kroll$3) [10,101707] Setting ready state to 1
       [TRACE] D/dalvikvm( 1729): GC_FOR_MALLOC freed 12700 objects / 611088 bytes in 124ms
       [TRACE] D/dalvikvm( 1729): GC_FOR_MALLOC freed 1967 objects / 297312 bytes in 369ms
       [TRACE] D/TiHttpClient( 1729): (TiHttpClient-2) [2521,104228] Setting ready state to 2
       [TRACE] D/TiHttpClient( 1729): (TiHttpClient-2) [0,104228] Setting ready state to 3
       [TRACE] E/TiHttpClient( 1729): (TiHttpClient-2) [2,104230] HTTP Error (java.lang.NullPointerException): java.lang.NullPointerException
       [TRACE] E/TiHttpClient( 1729): java.lang.NullPointerException
       [TRACE] E/TiHttpClient( 1729): at ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.finishedReceivingEntityData(TiHTTPClient.java:321)
       [TRACE] E/TiHttpClient( 1729): at ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.handleResponse(TiHTTPClient.java:257)
       [TRACE] E/TiHttpClient( 1729): at ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.handleResponse(TiHTTPClient.java:166)
       [TRACE] E/TiHttpClient( 1729): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:657)
       [TRACE] E/TiHttpClient( 1729): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:637)
       [TRACE] E/TiHttpClient( 1729): at ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1010)
       [TRACE] E/TiHttpClient( 1729): at java.lang.Thread.run(Thread.java:1096)
       [TRACE] I/TiHttpClient( 1729): (TiHttpClient-2) [3,104233] Sending error java.lang.NullPointerException
       
  4. Anthony Webb 2011-04-15

    Note, this is probably a separate issue. My issue only occurs when the webserver returns nothing, except for a 200. If there is no body I get the NPE, can this issue be the same or should I create a separate ticket?

  5. Don Thorp 2011-04-15

    Anthony Please go ahead and open a new ticket assigned to me. With the sample code and log that runs from your Q&A post.

  6. Marshall Culpepper 2011-04-15

    confirmed 204 no longer crashes, resolving

JSON Source