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

  • Home
  • SEARCH
  • 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 8585367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:02:43+00:00 2026-06-11T22:02:43+00:00

Possible Duplicate: Exception is NULL always I’ve got a strange problem with an IOException

  • 0

Possible Duplicate:
Exception is NULL always

I’ve got a strange problem with an IOException object and couldn’t find an answer for this.

Code looks like this:

try { // This isn't very important part, but maybe it has something to do with a problem
  HttpResponse response = client.execute(httpGet);
  StatusLine statusLine = response.getStatusLine();
  int statusCode = statusLine.getStatusCode();
  if (statusCode == 200) {
    HttpEntity entity = response.getEntity();
    InputStream content = entity.getContent();
    BufferedReader reader = new BufferedReader(new InputStreamReader(content));
    String line;
    while ((line = reader.readLine()) != null) {
      builder.append(line);
    }
  } else {
    Log.e(ParseJSON.class.toString(), "Failed to download file");
  }
} catch (IOException e) {
        System.out.println("I'm here in the IOException catch clause");
        e.printStackTrace(); // e is null (line 126)
} catch (Exception e) {
        e.printStackTrace();
}

Program catches IOException, but its object (e) is null. How is this possible?

Edit: Stack Trace:

09-25 19:35:59.438: I/System.out(31732): I'm here in the IOException catch clause
09-25 19:36:04.377: W/dalvikvm(31732): threadid=1: thread exiting with uncaught exception (group=0x40020ac0)
09-25 19:36:04.447: E/AndroidRuntime(31732): FATAL EXCEPTION: main
09-25 19:36:04.447: E/AndroidRuntime(31732): java.lang.RuntimeException: Unable to start activity ComponentInfo{uniwersytet.ekiosk/uniwersytet.ekiosk.EkioskActivity}: java.lang.NullPointerException
09-25 19:36:04.447: E/AndroidRuntime(31732):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
09-25 19:36:04.447: E/AndroidRuntime(31732):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
09-25 19:36:04.447: E/AndroidRuntime(31732):    at android.app.ActivityThread.access$2300(ActivityThread.java:125)
09-25 19:36:04.447: E/AndroidRuntime(31732):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
09-25 19:36:04.447: E/AndroidRuntime(31732):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-25 19:36:04.447: E/AndroidRuntime(31732):    at android.os.Looper.loop(Looper.java:123)
09-25 19:36:04.447: E/AndroidRuntime(31732):    at android.app.ActivityThread.main(ActivityThread.java:4627)
09-25 19:36:04.447: E/AndroidRuntime(31732):    at java.lang.reflect.Method.invokeNative(Native Method)
09-25 19:36:04.447: E/AndroidRuntime(31732):    at java.lang.reflect.Method.invoke(Method.java:521)
09-25 19:36:04.447: E/AndroidRuntime(31732):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
09-25 19:36:04.447: E/AndroidRuntime(31732):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
09-25 19:36:04.447: E/AndroidRuntime(31732):    at dalvik.system.NativeStart.main(Native Method)
09-25 19:36:04.447: E/AndroidRuntime(31732): Caused by: java.lang.NullPointerException
09-25 19:36:04.447: E/AndroidRuntime(31732):    at uniwersytet.ekiosk.EkioskActivity.onCreate(EkioskActivity.java:126)
09-25 19:36:04.447: E/AndroidRuntime(31732):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-25 19:36:04.447: E/AndroidRuntime(31732):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
09-25 19:36:04.447: E/AndroidRuntime(31732):    ... 11 more
  • 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-06-11T22:02:44+00:00Added an answer on June 11, 2026 at 10:02 pm

    – Please check the response you are getting from the Server.

    – Please also take note of it… that UI work should be on UI thread and Non-UI work on the Non-UI thread, from HoneyComb Version of Android it became a rule.

    – Please use a thread with handler, or AsyncTask for this kind of long time taking tasks.

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

Sidebar

Related Questions

Possible Duplicate: Runtime exception, recursion too deep I'm getting a problem while developing a
Possible Duplicate: catch exception by pointer in C++ I always catch exceptions by value.
Possible Duplicate: Java: Global Exception Handler I thought of something like this: public static
Possible Duplicate: Why do I get a null pointer exception from TabWidget? I have
Possible Duplicate: Shortcut for “null if object is null, or object.member if object is
Possible Duplicate: Eclipse debugger always blocks on ThreadPoolExecutor without any obvious exception, why? Eclipse
Possible Duplicate: Getting exception as “Collection was mutated while being enumerated” This question is
Possible Duplicate: ConcurrentModificationException and a HashMap I am getting the following exception Exception in
Possible Duplicate: RegEx match open tags except XHTML self-contained tags I have this list
Possible Duplicate: Exception in thread “main” java.lang.UnsupportedClassVersionError: a (Unsupporte d major.minor version 51.0) i

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.