Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UrlBasedVerifierProvider appends null at the end of json read from URL #9

Open
GoogleCodeExporter opened this issue Feb 24, 2016 · 0 comments

Comments

@GoogleCodeExporter
Copy link

In file  net.oauth.jsontoken.discovery.UrlBasedVerifierProvider.java, method 
public List<Verifier> findVerifier(String issuer, String keyId) 

52        do {
53          line = buff.readLine();
54          content.append(line + "\n");
55        } while (line != null);


57        JsonParser parser = new JsonParser();
58        JsonObject jsonObject = 
parser.parse(content.toString()).getAsJsonObject();


When code reads certificates by fetching from URL which expects simple json 
format, for example:
 {"keyid":"x509 certificate in Pem format", "keyid2":"x509 certificate in Pem format"..}, 

code at 52-55 appends null at the end of json. 

When code 57-58 parses that json, it gives following error:

com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) 
to accept malformed JSON at line 2 column 2 path $


Solution:
          Before appending line to content, make a check if(line != null)

        do {
          line = buff.readLine();

          if(line != null)   
             content.append(line + "\n");

        } while (line != null);


Original issue reported on code.google.com by abg326...@gmail.com on 3 Aug 2015 at 8:10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant