
jsontoken - issue #9
UrlBasedVerifierProvider appends null at the end of json read from URL
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);
Status: New
Labels:
Type-Defect
Priority-Medium