java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

Do you know how to solve this issue? Write a tip to help other users and build your expert profile.

Solutions on the web

via GitHub by weijjia
, 1 year ago
Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
via Stack Overflow by Supradip Muralidharan
, 7 months ago
Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
via Stack Overflow by Sanoop Vasu
, 1 year ago
Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
via google.com by Unknown author, 2 years ago
Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
via Stack Overflow by J.FOG
, 1 year ago
Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
at libcore.net.UriCodec.encode(UriCodec.java:132)
at java.net.URLEncoder.encode(URLEncoder.java:57)
at com.microsoft.aad.adal.StringExtensions.URLFormEncode(StringExtensions.java:83)
at com.microsoft.aad.adal.Oauth2.buildRefreshTokenRequestMessage(Oauth2.java:177)
at com.microsoft.aad.adal.Oauth2.refreshToken(Oauth2.java:302)
at com.microsoft.aad.adal.AcquireTokenSilentHandler.acquireTokenWithRefreshToken(AcquireTokenSilentHandler.java:126)
at com.microsoft.aad.adal.AcquireTokenSilentHandler.acquireTokenWithCachedItem(AcquireTokenSilentHandler.java:269)
at com.microsoft.aad.adal.AcquireTokenSilentHandler.useMRRT(AcquireTokenSilentHandler.java:261)
at com.microsoft.aad.adal.AcquireTokenSilentHandler.tryMRRT(AcquireTokenSilentHandler.java:203)
at com.microsoft.aad.adal.AcquireTokenSilentHandler.tryRT(AcquireTokenSilentHandler.java:161)
at com.microsoft.aad.adal.AcquireTokenSilentHandler.getAccessToken(AcquireTokenSilentHandler.java:104)
at com.microsoft.aad.adal.AuthenticationContext.localFlow(AuthenticationContext.java:1461)
at com.microsoft.aad.adal.AuthenticationContext.acquireTokenAfterValidation(AuthenticationContext.java:1448)
at com.microsoft.aad.adal.AuthenticationContext.acquireTokenLocalCall(AuthenticationContext.java:1261)
at com.microsoft.aad.adal.AuthenticationContext.access$900(AuthenticationContext.java:73)
at com.microsoft.aad.adal.AuthenticationContext$7.run(AuthenticationContext.java:1220)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

Users with the same issue

Samebug visitor profile picture
Unknown user
2 times, 3 weeks ago
41 times, 2 months ago
382 times, 1 year ago
6 times, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.