• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

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

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:

 
Been there. Done that. Went back for more. But this time, I took this tiny ad with me:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic