fix outdated link, improve docstring (#10870)

This commit is contained in:
William Cheng
2021-11-17 11:17:48 +08:00
committed by GitHub
parent fcb28453e3
commit e44c69dab1
6 changed files with 48 additions and 6 deletions

View File

@@ -151,6 +151,13 @@ public class JSON {
return this;
}
/**
* Configure the parser to be liberal in what it accepts.
*
* @param lenientOnJson Set it to true to ignore some syntax errors
* @return JSON
* @see <a href="https://www.javadoc.io/doc/com.google.code.gson/gson/2.8.5/com/google/gson/stream/JsonReader.html">https://www.javadoc.io/doc/com.google.code.gson/gson/2.8.5/com/google/gson/stream/JsonReader.html</a>
*/
public JSON setLenientOnJson(boolean lenientOnJson) {
isLenientOnJson = lenientOnJson;
return this;
@@ -179,7 +186,7 @@ public class JSON {
try {
if (isLenientOnJson) {
JsonReader jsonReader = new JsonReader(new StringReader(body));
// see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean)
// see https://www.javadoc.io/doc/com.google.code.gson/gson/2.8.5/com/google/gson/stream/JsonReader.html
jsonReader.setLenient(true);
return gson.fromJson(jsonReader, returnType);
} else {