Any idea what might be causing this NPE?

13 views
Skip to first unread message

Mark Thomas

unread,
Sep 24, 2013, 5:21:33 PM9/24/13
to flickrj...@googlegroups.com
We see occasional integration test failures that contain a stack trace with this NullPointerException.

2013-09-24 11:38:27,209 [main] INFO  c.g.f.RequestContext Set new OAuth OAuth [token=OAuthToken [oauthToken=<snipped>, oauthTokenSecret=<snipped>], user=null] to the current RequestContext instance com.googlecode.flickrjandroid.RequestContext@215983b7

2013-09-24 11:38:27,210 [main] DEBUG c.g.f.o.OAuthUtils Generated OAuth Base String: POST&http%3A%2F%2Fwww.flickr.com%2Fservices%2Frest&extras%3Ddate_upload%252Cowner_name%252Cdescription%252Curl_s%252Curl_m%252Curl_l%26format%3Djson%26media%3Dphotos%26method%3Dflickr.photos.search%26nojsoncallback%3D1%26oauth_consumer_key%<snipped>%26oauth_nonce%3D4477049999256962%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1380047907%26oauth_token%<snipped>%26oauth_version%3D1.0%26page%3D1%26per_page%3D250%26user_id%3D<snipped>

2013-09-24 11:38:27,211 [main] DEBUG c.g.f.REST Send Post Input Params: path '/services/rest'; parameters [Parameter [name=extras, value=date_upload,owner_name,description,url_s,url_m,url_l], Parameter [name=format, value=json], Parameter [name=media, value=photos], Parameter [name=method, value=flickr.photos.search], Parameter [name=nojsoncallback, value=1], Parameter [name=oauth_consumer_key, value=<snipped>], Parameter [name=oauth_nonce, value=4477049999256962], Parameter [name=oauth_signature_method, value=HMAC-SHA1], Parameter [name=oauth_timestamp, value=1380047907], Parameter [name=oauth_token, value=<snipped>], Parameter [name=oauth_version, value=1.0], Parameter [name=page, value=1], Parameter [name=per_page, value=250], Parameter [name=user_id, value=<snipped>], Parameter [name=oauth_signature, value=hEqozVWWhVj3KSWwUrNBX7O9TPY=]]

2013-09-24 11:38:27,211 [main] DEBUG c.g.f.REST Post URL: http://www.flickr.com:80/services/rest

2013-09-24 11:41:06,913 [main] DEBUG c.g.f.REST Send Post Result: null

2013-09-24 11:41:06,923 [main] ERROR c.c.c.c.x.p.s.FlickrProvider message=getPhotostreamImages: Unable to access Flickr. | url=flickr.photosets.getList Error details: errorType=1 | description=Error fetching the info from an image provider. | httpStatusCode=-1 | apiErrorMessage=null | apiErrorType=null | apiErrorCode=null | apiErrorSubCode=null

java.lang.NullPointerException: null
at java.io.Reader.<init>(Reader.java:61) ~[na:1.6.0_30]
at java.io.InputStreamReader.<init>(InputStreamReader.java:55) ~[na:1.6.0_30]
at com.googlecode.flickrjandroid.REST.readFromStream(REST.java:339) ~[flickrj-android-2.0.8-SNAPSHOT.jar:na]
at com.googlecode.flickrjandroid.REST.sendPost(REST.java:317) ~[flickrj-android-2.0.8-SNAPSHOT.jar:na]
at com.googlecode.flickrjandroid.REST.post(REST.java:357) ~[flickrj-android-2.0.8-SNAPSHOT.jar:na]
at com.googlecode.flickrjandroid.Transport.postJSON(Transport.java:113) ~[flickrj-android-2.0.8-SNAPSHOT.jar:na]
at com.googlecode.flickrjandroid.photos.PhotosInterface.search(PhotosInterface.java:996) ~[flickrj-android-2.0.8-SNAPSHOT.jar:na]
at com.<snipped>.FlickrProvider.getPhotostreamImages(FlickrProvider.java:156) 

There's almost exactly 160 seconds between the 2 debug messages which seems to indicate this might be caused by a timeout on either our side or Flickr's side.  So it seems like the fix might be to allow flickrj-android to be able to handle empty responses without causing the NPE to be thrown.  What do you guys think?

I tried looking at the code to see how it might be possible for the POST result to be null.  I don't see a code path where that might be possible though...
Reply all
Reply to author
Forward
0 new messages