debbiereid / google-api-java-client

Automatically exported from code.google.com/p/google-api-java-client
0 stars 0 forks source link

GoogleIdToken.Payload check() throws NullPointerException #850

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Version of google-api-java-client (e.g. 1.15.0-rc)?
1.17.0-rc

Java environment (e.g. Java 6, Android 2.3, App Engine)?
java version "1.7.0_45"

Describe the problem.
I tested GoogleIdToken.Payload check() with a new valid token 25 times. It 
throws a NullPointerException randomly. (Probability: <5%)

After searching the web, I found 
http://stackoverflow.com/questions/18918411/google-id-token-checker-for-java-che
ck-return-null describing a similar problem.

How would you expect it to be fixed?
1. Throw a more specific exception to let developers know what happens.
Or
2. Fix it so it won't throw NullPointerException.

For example, if the token is invalid, throwing IllegalArgumentException is more 
informative. If there is no network connection to verify the token, please 
throw a subclass of IOException.
Throwing NPE does not give any information.

Original issue reported on code.google.com by cooperat...@gmail.com on 20 Dec 2013 at 2:30