Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1808760
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:18:11+00:00 2026-05-17T06:18:11+00:00

I get a very common crash below from the code below. I thought my

  • 0

I get a very common crash below from the code below.

I thought my try, catches will have handled that.

java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:200)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
at java.lang.Thread.run(Thread.java:1102)
Caused by: java.lang.NullPointerException
at java.io.Reader.<init>(Reader.java:65)
at java.io.InputStreamReader.<init>(InputStreamReader.java:65)
at com.test.test.FinderMain.grabPlaneRoute(FinderMain.java:759)
at com.test.test.FinderMain.access$7(FinderMain.java:729)
at com.test.test.FinderMain$GetRouteTask.doInBackground(FinderMain.java:684)
at com.test.test.FinderMain$GetRouteTask.doInBackground(FinderMain.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:185)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)

Line 759 is within grabPlaneRoute and is the line containing the “StringBuilder total = new StringBuilder();”

Can someone help with this, it is driving me crazy! 🙂

private void grabPlaneRoute(String adshex) {


    List<GeoPoint> localList = new ArrayList<GeoPoint>();

    HttpURLConnection con = null;
    URL url;
    InputStream is=null;
    try {
        url = new URL("http://www.testurl.com&test=" + adshex);

        con = (HttpURLConnection) url.openConnection();
        con.setReadTimeout(20000 /* milliseconds */);
        con.setConnectTimeout(60000 /* milliseconds */);
        con.setRequestMethod("GET");
        con.setDoInput(true);

        // Start the query
        con.connect();
        is = con.getInputStream();
    }catch (IOException e) {
                    //handle the exception !
        e.printStackTrace();
        return;
    }

    //localList = decodePoly(convertStreamToString(is));
    //Log.i("HTTP DUMP", convertStreamToString(is));

    BufferedReader r = new BufferedReader(new InputStreamReader(is),8024);
    StringBuilder total = new StringBuilder();
    String line;
     try {
    while ((line = r.readLine()) != null) {
        String[] separated = line.split(",");

        GeoPoint p = getPoint(Double.valueOf(separated[0]),Double.valueOf(separated[1]));
        localList.add(p);
    }
     }catch (IOException e) {
         //handle the exception !
            e.printStackTrace(); 
     }



    drawPlaneRoute(localList);


}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T06:18:12+00:00Added an answer on May 17, 2026 at 6:18 am

    It’s fairly impossible for StringBuilder total = new StringBuilder(); to cause a NullPointerException. On the other hand, the nearest cause of the Exception is in the logtrace:

    at java.io.Reader.<init>(Reader.java:65)
    at java.io.InputStreamReader.<init>(InputStreamReader.java:65)
    

    Which makes me think that it’s caused by:

    BufferedReader r = new BufferedReader(new InputStreamReader(is),8024);
    

    In that case, the only thing that could be null is is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I thought I'd try my luck on ASP.NET. I didn't get very far
I know that this is very common problem and I have gone through almost
I am using gmp's mpf_t to try and get very high precision. My range
I know this is a very common problem. I was trying to get a
I have the very common problem of creating an index for an in-disk array
Often in programming, it is a very common requirement that some piece of functionality
I am from an XP background. I know the process very well and have
I am sure this problem is very common but a quick googling didn't get
Not a very common implementation, but using Processing as a Java Servlet has been
I have a very common HABTM relationship between Product and Category. I'm based on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.