/** * Creates a {@link JsonParserException} and fills it from the current line and char position. */ private JsonParserException createParseException(Exception e, String message, boolean tokenPos) { if (tokenPos) return new JsonParserException(e, message + " on line " + tokenLinePos + ", char " + tokenCharPos, tokenLinePos, tokenCharPos, tokenCharOffset); else { int charPos = Math.max(1, index - rowPos - utf8adjust); return new JsonParserException(e, message + " on line " + linePos + ", char " + charPos, linePos, charPos, index + charOffset); } } }
/** * Creates a {@link JsonParserException} and fills it from the current line and char position. */ private JsonParserException createParseException(Exception e, String message, boolean tokenPos) { if (tokenPos) return new JsonParserException(e, message + " on line " + tokenLinePos + ", char " + tokenCharPos, tokenLinePos, tokenCharPos, tokenCharOffset); else { int charPos = Math.max(1, index - rowPos - utf8adjust); return new JsonParserException(e, message + " on line " + linePos + ", char " + charPos, linePos, charPos, index + charOffset); } } }
/** * Creates a {@link JsonParserException} and fills it from the current line and char position. */ private JsonParserException createParseException(Exception e, String message, boolean tokenPos) { if (tokenPos) return new JsonParserException(e, message + " on line " + tokenLinePos + ", char " + tokenCharPos, tokenLinePos, tokenCharPos, tokenCharOffset); else { int charPos = Math.max(1, index - rowPos - utf8adjust); return new JsonParserException(e, message + " on line " + linePos + ", char " + charPos, linePos, charPos, index + charOffset); } } }
@Override public Object parse(String json) throws JsonParserException { try { JavaScriptObject jsonParse = jsonParse(json); if (!isValueObject(jsonParse)) throw new JsonParserException(null, "Input JSON was not an object", -1, -1, -1); HtmlObject object = (HtmlObject) unwrap0(jsonParse); return object; } catch (JavaScriptException e) { throw new JsonParserException(e, "Failed to parse JSON", -1, -1, -1); } }
@Override public Array parseArray(String json) throws JsonParserException { try { JavaScriptObject jsonParse = jsonParse(json); if (!isValueArray(jsonParse)) throw new JsonParserException(null, "Input JSON was not an array", -1, -1, -1); HtmlArray array = (HtmlArray) unwrap0(jsonParse); return array; } catch (JavaScriptException e) { throw new JsonParserException(e, "Failed to parse JSON", -1, -1, -1); } }
@Override public Array parseArray(String json) throws JsonParserException { try { JavaScriptObject jsonParse = jsonParse(json); if (!isValueArray(jsonParse)) throw new JsonParserException(null, "Input JSON was not an array", -1, -1, -1); HtmlArray array = (HtmlArray) unwrap0(jsonParse); return array; } catch (JavaScriptException e) { throw new JsonParserException(e, "Failed to parse JSON", -1, -1, -1); } }
@Override public Object parse(String json) throws JsonParserException { try { JavaScriptObject jsonParse = jsonParse(json); if (!isValueObject(jsonParse)) throw new JsonParserException(null, "Input JSON was not an object", -1, -1, -1); HtmlObject object = (HtmlObject) unwrap0(jsonParse); return object; } catch (JavaScriptException e) { throw new JsonParserException(e, "Failed to parse JSON", -1, -1, -1); } }
@Override public Object parse(String json) throws JsonParserException { try { JavaScriptObject jsonParse = jsonParse(json); if (!isValueObject(jsonParse)) throw new JsonParserException(null, "Input JSON was not an object", -1, -1, -1); HtmlObject object = (HtmlObject) unwrap0(jsonParse); return object; } catch (JavaScriptException e) { throw new JsonParserException(e, "Failed to parse JSON", -1, -1, -1); } }
@Override public Array parseArray(String json) throws JsonParserException { try { JavaScriptObject jsonParse = jsonParse(json); if (!isValueArray(jsonParse)) throw new JsonParserException(null, "Input JSON was not an array", -1, -1, -1); HtmlArray array = (HtmlArray) unwrap0(jsonParse); return array; } catch (JavaScriptException e) { throw new JsonParserException(e, "Failed to parse JSON", -1, -1, -1); } }