case 'u': { if (pos + 4 > in.length()) { throw syntaxError("Unterminated escape sequence"); return (char) Integer.parseInt(hex, 16); } catch (NumberFormatException nfe) { throw syntaxError("Invalid escape sequence: " + hex); throw syntaxError("Unterminated escape sequence"); return (char) Integer.parseInt(hex, 16); } catch (NumberFormatException nfe) { throw syntaxError("Invalid escape sequence: " + hex);
case 'u': { if (pos + 4 > in.length()) { throw syntaxError("Unterminated escape sequence"); return (char) Integer.parseInt(hex, 16); } catch (NumberFormatException nfe) { throw syntaxError("Invalid escape sequence: " + hex); throw syntaxError("Unterminated escape sequence"); return (char) Integer.parseInt(hex, 16); } catch (NumberFormatException nfe) { throw syntaxError("Invalid escape sequence: " + hex);
throw syntaxError("Unterminated escape sequence"); throw syntaxError("Unterminated string");
throw syntaxError("Unterminated escape sequence"); throw syntaxError("Unterminated string");
throw syntaxError("Missing value"); } else if ("null".equalsIgnoreCase(literal)) { return JSONObject.NULL;
throw syntaxError("Missing value"); } else if ("null".equalsIgnoreCase(literal)) { return JSONObject.NULL;
/** * Returns the next value from the input. * * @return a {@link JSONObject}, {@link JSONArray}, String, Boolean, * Integer, Long, Double or {@link JSONObject#NULL}. * @throws RuntimeException if the input is malformed. */ Object nextValue(Class<?> desiredType) { int c = nextCleanInternal(); if (JSONObject.class.equals(desiredType) && c != '{'){ throw syntaxError("A JSONObject text must begin with '{'"); } if (JSONArray.class.equals(desiredType) && c != '['){ throw syntaxError("A JSONArray text must start with '['"); } switch (c) { case -1: throw syntaxError("End of input"); case '{': return readObject(); case '[': return readArray(); case '\'': case '"': return nextString((char) c); default: pos--; return readLiteral(); } }
if (commentEnd == -1) { pos = in.length(); throw syntaxError("Unclosed comment");
/** * Returns the next value from the input. * * @return a {@link JSONObject}, {@link JSONArray}, String, Boolean, * Integer, Long, Double or {@link JSONObject#NULL}. * @throws RuntimeException if the input is malformed. */ Object nextValue(Class<?> desiredType) { int c = nextCleanInternal(); if (JSONObject.class.equals(desiredType) && c != '{'){ throw syntaxError("A JSONObject text must begin with '{'"); } if (JSONArray.class.equals(desiredType) && c != '['){ throw syntaxError("A JSONArray text must start with '['"); } switch (c) { case -1: throw syntaxError("End of input"); case '{': return readObject(); case '[': return readArray(); case '\'': case '"': return nextString((char) c); default: pos--; return readLiteral(); } }
if (commentEnd == -1) { pos = in.length(); throw syntaxError("Unclosed comment");
if (e.getMessage().equals("End of input" + this)){ throw syntaxError("A JSONObject text must end with '}'"); throw syntaxError("Names cannot be null"); } else { throw syntaxError("Names must be strings, but " + name + " is of type " + name.getClass().getName()); throw syntaxError("Expected a ':' after a key"); continue; default: throw syntaxError("Expected a ',' or '}'");
if (e.getMessage().equals("End of input" + this)){ throw syntaxError("A JSONObject text must end with '}'"); throw syntaxError("Names cannot be null"); } else { throw syntaxError("Names must be strings, but " + name + " is of type " + name.getClass().getName()); throw syntaxError("Expected a ':' after a key"); continue; default: throw syntaxError("Expected a ',' or '}'");
switch (nextCleanInternal()) { case -1: throw syntaxError("Expected a ',' or ']'"); case ']': if (hasTrailingSeparator) { continue; default: throw syntaxError("Expected a ',' or ']'");
switch (nextCleanInternal()) { case -1: throw syntaxError("Expected a ',' or ']'"); case ']': if (hasTrailingSeparator) { continue; default: throw syntaxError("Expected a ',' or ']'");