char c = src.charAt(pos++); if (c <= '\u001F') { throw new ParseException("String contains control character"); } else if (c == '\\') { break; b.append(src, stringStart, pos - 1); if (pos >= length) { throw new ParseException("Unterminated string"); case 'u': if (length - pos < 5) { throw new ParseException("Invalid character code: \\u" + src.substring(pos)); | fromHex(src.charAt(pos + 3)); if (code < 0) { throw new ParseException("Invalid character code: " + src.substring(pos, pos + 4)); break; default: throw new ParseException("Unexpected character in string: '\\" + c + "'"); c = src.charAt(pos++); if (c <= '\u001F') { throw new ParseException("String contains control character"); } else if (c == '\\') { break; throw new ParseException("Unterminated string literal");
char c = src.charAt(pos++); if (c <= '\u001F') { throw new ParseException("String contains control character"); } else if (c == '\\') { break; b.append(src, stringStart, pos - 1); if (pos >= length) { throw new ParseException("Unterminated string"); case 'u': if (length - pos < 5) { throw new ParseException("Invalid character code: \\u" + src.substring(pos)); | fromHex(src.charAt(pos + 3)); if (code < 0) { throw new ParseException("Invalid character code: " + src.substring(pos, pos + 4)); break; default: throw new ParseException("Unexpected character in string: '\\" + c + "'"); c = src.charAt(pos++); if (c <= '\u001F') { throw new ParseException("String contains control character"); } else if (c == '\\') { break; throw new ParseException("Unterminated string literal");
char c = src.charAt(pos++); if (c <= '\u001F') { throw new ParseException("String contains control character"); } else if (c == '\\') { break; b.append(src, stringStart, pos - 1); if (pos >= length) { throw new ParseException("Unterminated string"); case 'u': if (length - pos < 5) { throw new ParseException("Invalid character code: \\u" + src.substring(pos)); | fromHex(src.charAt(pos + 3)); if (code < 0) { throw new ParseException("Invalid character code: " + src.substring(pos, pos + 4)); break; default: throw new ParseException("Unexpected character in string: '\\" + c + "'"); c = src.charAt(pos++); if (c <= '\u001F') { throw new ParseException("String contains control character"); } else if (c == '\\') { break; throw new ParseException("Unterminated string literal");
char c = src.charAt(pos++); if (c <= '\u001F') { throw new ParseException("String contains control character"); } else if (c == '\\') { break; b.append(src, stringStart, pos - 1); if (pos >= length) { throw new ParseException("Unterminated string"); case 'u': if (length - pos < 5) { throw new ParseException("Invalid character code: \\u" + src.substring(pos)); | fromHex(src.charAt(pos + 3)); if (code < 0) { throw new ParseException("Invalid character code: " + src.substring(pos, pos + 4)); break; default: throw new ParseException("Unexpected character in string: '\\" + c + "'"); c = src.charAt(pos++); if (c <= '\u001F') { throw new ParseException("String contains control character"); } else if (c == '\\') { break; throw new ParseException("Unterminated string literal");
case '}': if (!needsComma) { throw new ParseException("Unexpected comma in object literal"); throw new ParseException("Unexpected comma in object literal"); case '"': if (needsComma) { throw new ParseException("Missing comma in object literal"); break; default: throw new ParseException("Unexpected token in object literal"); throw new ParseException("Unterminated object literal");
case '}': if (!needsComma) { throw new ParseException("Unexpected comma in object literal"); throw new ParseException("Unexpected comma in object literal"); case '"': if (needsComma) { throw new ParseException("Missing comma in object literal"); break; default: throw new ParseException("Unexpected token in object literal"); throw new ParseException("Unterminated object literal");
case '}': if (!needsComma) { throw new ParseException("Unexpected comma in object literal"); throw new ParseException("Unexpected comma in object literal"); case '"': if (needsComma) { throw new ParseException("Missing comma in object literal"); break; default: throw new ParseException("Unexpected token in object literal"); throw new ParseException("Unterminated object literal");
case '}': if (!needsComma) { throw new ParseException("Unexpected comma in object literal"); throw new ParseException("Unexpected comma in object literal"); case '"': if (needsComma) { throw new ParseException("Missing comma in object literal"); break; default: throw new ParseException("Unexpected token in object literal"); throw new ParseException("Unterminated object literal");
return readNumber(c); default: throw new ParseException("Unexpected token: " + c); throw new ParseException("Empty JSON string");
case ']': if (!needsComma) { throw new ParseException("Unexpected comma in array literal"); case ',': if (!needsComma) { throw new ParseException("Unexpected comma in array literal"); default: if (needsComma) { throw new ParseException("Missing comma in array literal"); throw new ParseException("Unterminated array literal");
return readNumber(c); default: throw new ParseException("Unexpected token: " + c); throw new ParseException("Empty JSON string");
case ']': if (!needsComma) { throw new ParseException("Unexpected comma in array literal"); case ',': if (!needsComma) { throw new ParseException("Unexpected comma in array literal"); default: if (needsComma) { throw new ParseException("Missing comma in array literal"); throw new ParseException("Unterminated array literal");
case ']': if (!needsComma) { throw new ParseException("Unexpected comma in array literal"); case ',': if (!needsComma) { throw new ParseException("Unexpected comma in array literal"); default: if (needsComma) { throw new ParseException("Missing comma in array literal"); throw new ParseException("Unterminated array literal");
case ']': if (!needsComma) { throw new ParseException("Unexpected comma in array literal"); case ',': if (!needsComma) { throw new ParseException("Unexpected comma in array literal"); default: if (needsComma) { throw new ParseException("Missing comma in array literal"); throw new ParseException("Unterminated array literal");
return readNumber(c); default: throw new ParseException("Unexpected token: " + c); throw new ParseException("Empty JSON string");
return readNumber(c); default: throw new ParseException("Unexpected token: " + c); throw new ParseException("Empty JSON string");
private ParseException numberError(int start, int end) { return new ParseException("Unsupported number format: " + src.substring(start, end)); }
public synchronized Object parseValue(String json) throws ParseException { if (json == null) { throw new ParseException("Input string may not be null"); } pos = 0; length = json.length(); src = json; Object value = readValue(); consumeWhitespace(); if (pos < length) { throw new ParseException("Expected end of stream at char " + pos); } return value; }
public synchronized Object parseValue(String json) throws ParseException { if (json == null) { throw new ParseException("Input string may not be null"); } pos = 0; length = json.length(); src = json; Object value = readValue(); consumeWhitespace(); if (pos < length) { throw new ParseException("Expected end of stream at char " + pos); } return value; }
public synchronized Object parseValue(String json) throws ParseException { if (json == null) { throw new ParseException("Input string may not be null"); } pos = 0; length = json.length(); src = json; Object value = readValue(); consumeWhitespace(); if (pos < length) { throw new ParseException("Expected end of stream at char " + pos); } return value; }