5556575859606162
return new Gson(); } }; } catch (ClassNotFoundException e) { logger.error("Gson not found on class path. No converters configured."); throw new JsonPathException("Gson not found on path", e); } }
7677787980818283
try { return createParser().parse(new InputStreamReader(jsonStream, charset), mapper); } catch (ParseException e) { throw new InvalidJsonException(e); } catch (UnsupportedEncodingException e) { throw new JsonPathException(e); } }
158159160161162163164
} else if (isMap(obj)){ return getPropertyKeys(obj).size(); } else if(obj instanceof String){ return ((String)obj).length(); } throw new JsonPathException("length operation can not applied to " + obj!=null?obj.getClass().getName():"null"); }
101102103104105106107108
public Object parse(InputStream jsonStream, String charset) throws InvalidJsonException { try { return parser.parse(new InputStreamReader(jsonStream, charset)); } catch (UnsupportedEncodingException e) { throw new JsonPathException(e); } }
222223224225226227228
if (element.isJsonPrimitive()) { return element.toString().length(); } } } throw new JsonPathException("length operation can not applied to " + obj != null ? obj.getClass().getName() : "null"); }
306307308309310311312313314315316
// stream closed in the finally out = new ObjectOutputStream(outputStream); out.writeObject(obj); } catch (IOException ex) { throw new JsonPathException(ex); } finally { try { if (out != null) { out.close(); }
361362363364365366367368369370371372373
// stream closed in the finally in = new ObjectInputStream(inputStream); return in.readObject(); } catch (ClassNotFoundException ex) { throw new JsonPathException(ex); } catch (IOException ex) { throw new JsonPathException(ex); } finally { try { if (in != null) { in.close(); }
676869707172737475
} @Override public String toJson(Object obj) { if (!(obj instanceof JsonNode)) { throw new JsonPathException("Not a JSON Node"); } return toString(); }
220221222223224225226
if (obj instanceof TextNode) { TextNode element = (TextNode) obj; return element.size(); } } throw new JsonPathException("length operation can not applied to " + obj != null ? obj.getClass().getName() : "null"); }