question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NullPointerException in TokenRequestTask execution

See original GitHub issue

I use the version 0.7.0 of the library and sometimes get the following error:

Caused by java.lang.NullPointerException
       at java.io.Reader.<init>(Reader.java:78)
       at java.io.InputStreamReader.<init>(InputStreamReader.java:72)
       at net.openid.appauth.Utils.readInputStream(Utils.java:36)
       at net.openid.appauth.AuthorizationService$TokenRequestTask.doInBackground(AuthorizationService.java:431)
       at net.openid.appauth.AuthorizationService$TokenRequestTask.doInBackground(AuthorizationService.java:375)
       at android.os.AsyncTask$2.call(AsyncTask.java:333)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:764)

This crash happens when the input stream is null, e.g. the server is out of business.

Would it be possible to handle a null input stream as network error?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
5eemancommented, Aug 5, 2020

I’ve faced with the same issue or similar and can’t find any solution at the moment. I’m using version 0.7.1. Here is the error output.

java.lang.RuntimeException: An error occurred while executing doInBackground()
        at android.os.AsyncTask$4.done(AsyncTask.java:399)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
        at java.util.concurrent.FutureTask.run(FutureTask.java:271)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)
     Caused by: java.lang.NullPointerException
        at java.io.Reader.<init>(Reader.java:78)
        at java.io.InputStreamReader.<init>(InputStreamReader.java:72)
        at net.openid.appauth.Utils.readInputStream(Utils.java:36)
        at net.openid.appauth.AuthorizationService$TokenRequestTask.doInBackground(AuthorizationService.java:453)
        at net.openid.appauth.AuthorizationService$TokenRequestTask.doInBackground(AuthorizationService.java:395)
        at android.os.AsyncTask$3.call(AsyncTask.java:378)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:919) 
0reactions
iainmcgincommented, Oct 1, 2018

Should now be fixed by the merge of #414.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - What is a NullPointerException, and how do I fix it?
This results in a NullPointerException because there is no code to execute in the location that the reference is pointing. (This is a...
Read more >
Java NullPointerException - Detect, Fix, and Best Practices
The below image shows the null pointer exception when the above program is executed in Eclipse IDE. Exception in thread main java.lang.
Read more >
IT38806: NULLPOINTEREXCEPTION DURING EXECUTION ...
While executing mqsicreatebar command a NullPointerException may occur. The exception example is.
Read more >
NullPointerException de-reference a null object in Apex code ...
This error is caused by a line of code that is trying to use an object that has not been instantiated, or an...
Read more >
java.lang.NullPointerException with in-process object ...
Following error occurs when calling an EDC enabled decision service using in-process object execution: com.corticon.reactor.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found