java.lang.ClassCastException

Issue #259 invalid
Rashmi N created an issue
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List
    at com.nimbusds.oauth2.sdk.util.URLUtils.serializeParameters(URLUtils.java:101)
    at com.microsoft.aad.adal4j.AdalTokenRequest.toOAuthRequest(AdalTokenRequest.java:119)
    at com.microsoft.aad.adal4j.AdalTokenRequest.executeOAuthRequestAndProcessResponse(AdalTokenRequest.java:71)
    at com.microsoft.aad.adal4j.AuthenticationContext.acquireTokenCommon(AuthenticationContext.java:726)
    at com.microsoft.aad.adal4j.AuthenticationContext.access$100(AuthenticationContext.java:61)
    at com.microsoft.aad.adal4j.AuthenticationContext$1.call(AuthenticationContext.java:128)
    at com.microsoft.aad.adal4j.AuthenticationContext$1.call(AuthenticationContext.java:117)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Comments (6)

  1. Rashmi N reporter

    i am trying to get an access token and attach it to a http request . It works fine in a normal java environment but when i try to deploy in another tool called activiti i am thrown with this issue .

  2. Connect2id OSS

    The issue is likely in the calling method:

    com.microsoft.aad.adal4j.AdalTokenRequest.toOAuthRequest(AdalTokenRequest.java:119)
    

    Please check with ADAL4j.

  3. Purna

    As documented on ADAL4J -

    https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/dev/src/main/java/com/microsoft/aad/adal4j/AdalTokenRequest.java

    Also, in URLUtils.java, serializeParameters is expecting MAP < String, LIST<String>> … same has been passed by AdalTokenRequest.

    ‌ public static String serializeParameters(final Map<String,List<String>> params)

    params is of MAP<String, LIST<String>> … but in src/main/java/com/nimbusds/oauth2/sdk/util/URLUtils.java,

    at line 101 - entry.getValue is assigned to “String” type… but Value in MAP is a LIST type… Please check.

    for (String value: entry.getValue()) {

  4. Log in to comment