mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for jsonparser
This commit is contained in:
@@ -71,17 +71,17 @@ public class JSONParser {
|
||||
if (token == Token.LBRACKET) {
|
||||
return parseArray();
|
||||
}
|
||||
|
||||
|
||||
if (token == Token.TRUE) {
|
||||
nextToken();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (token == Token.FALSE) {
|
||||
nextToken();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (token == Token.NULL) {
|
||||
nextToken();
|
||||
return null;
|
||||
@@ -208,7 +208,7 @@ public class JSONParser {
|
||||
scanDigit();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (text.startsWith("null", index)) {
|
||||
token = Token.NULL;
|
||||
index += 3;
|
||||
@@ -222,7 +222,7 @@ public class JSONParser {
|
||||
nextChar();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (text.startsWith("false", index)) {
|
||||
token = Token.FALSE;
|
||||
index += 4;
|
||||
@@ -301,6 +301,18 @@ public class JSONParser {
|
||||
strBuf.append('\f');
|
||||
} else if (ch == 't') {
|
||||
strBuf.append('\t');
|
||||
} else if (ch == 'u') {
|
||||
nextChar();
|
||||
char c1 = ch;
|
||||
nextChar();
|
||||
char c2 = ch;
|
||||
nextChar();
|
||||
char c3 = ch;
|
||||
nextChar();
|
||||
char c4 = ch;
|
||||
int val = Integer.parseInt(new String(new char[] { c1, c2, c3, c4 }), 16);
|
||||
strBuf.append((char) val);
|
||||
break;
|
||||
} else {
|
||||
throw new IllegalArgumentException("illegal string : " + strBuf);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user