Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FATAL EXCEPTION: ModernAsyncTask #1 An error occured while executing doInBackground()

 
Jared Snyder
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've never seen this error before and don't even know where to start. This Activity is supposed to fetch results from Google Places and is part of a search functionality that ties in with the search view widget. Someone set me in the right direction. Thanks!



PlaceProvider.java:



Details from logcat:

03-09 19:05:40.521: E/AndroidRuntime(6976): FATAL EXCEPTION: ModernAsyncTask #1
03-09 19:05:40.521: E/AndroidRuntime(6976): java.lang.RuntimeException: An error occured while executing doInBackground()
03-09 19:05:40.521: E/AndroidRuntime(6976): at android.support.v4.content.ModernAsyncTask$3.done(ModernAsyncTask.java:137)
03-09 19:05:40.521: E/AndroidRuntime(6976): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
03-09 19:05:40.521: E/AndroidRuntime(6976): at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
03-09 19:05:40.521: E/AndroidRuntime(6976): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
03-09 19:05:40.521: E/AndroidRuntime(6976): at java.util.concurrent.FutureTask.run(FutureTask.java:138)
03-09 19:05:40.521: E/AndroidRuntime(6976): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
03-09 19:05:40.521: E/AndroidRuntime(6976): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
03-09 19:05:40.521: E/AndroidRuntime(6976): at java.lang.Thread.run(Thread.java:1019)
03-09 19:05:40.521: E/AndroidRuntime(6976): Caused by: java.lang.NullPointerException
03-09 19:05:40.521: E/AndroidRuntime(6976): at java.net.URLEncoder.encode(URLEncoder.java:92)
03-09 19:05:40.521: E/AndroidRuntime(6976): at com.....PlaceProvider.getPlacesUrl(PlaceProvider.java:266)
03-09 19:05:40.521: E/AndroidRuntime(6976): at com.....PlaceProvider.getPlaces(PlaceProvider.java:290)
03-09 19:05:40.521: E/AndroidRuntime(6976): at com.....PlaceProvider.query(PlaceProvider.java:88)
03-09 19:05:40.521: E/AndroidRuntime(6976): at android.content.ContentProvider$Transport.query(ContentProvider.java:187)
03-09 19:05:40.521: E/AndroidRuntime(6976): at android.content.ContentResolver.query(ContentResolver.java:262)
03-09 19:05:40.521: E/AndroidRuntime(6976): at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:49)
03-09 19:05:40.521: E/AndroidRuntime(6976): at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:35)
03-09 19:05:40.521: E/AndroidRuntime(6976): at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:242)
03-09 19:05:40.521: E/AndroidRuntime(6976): at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:51)
03-09 19:05:40.521: E/AndroidRuntime(6976): at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:40)
03-09 19:05:40.521: E/AndroidRuntime(6976): at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:123)
03-09 19:05:40.521: E/AndroidRuntime(6976): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
03-09 19:05:40.521: E/AndroidRuntime(6976): ... 4 more
 
Jared Snyder
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, apparently the issue was related to the "qry" not being appropriately checked for null before being passed to the encoder.

This fixed it:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic