Package com.jayway.jsonpath

Examples of com.jayway.jsonpath.JsonPathException


                    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);
        }
    }
View Full Code Here


        try {
            return createParser().parse(new InputStreamReader(jsonStream, charset), mapper);
        } catch (ParseException e) {
            throw new InvalidJsonException(e);
        } catch (UnsupportedEncodingException e) {
            throw new JsonPathException(e);
        }
    }
View Full Code Here

        } 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");
    }
View Full Code Here

    public Object parse(InputStream jsonStream, String charset) throws InvalidJsonException {

        try {
            return parser.parse(new InputStreamReader(jsonStream, charset));
        } catch (UnsupportedEncodingException e) {
            throw new JsonPathException(e);
        }
    }
View Full Code Here

                if (element.isJsonPrimitive()) {
                    return element.toString().length();
                }
            }
        }
        throw new JsonPathException("length operation can not applied to " + obj != null ? obj.getClass().getName() : "null");
    }
View Full Code Here

            // 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();
                }
View Full Code Here

            // 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();
                }
View Full Code Here

    }

    @Override
    public String toJson(Object obj) {
        if (!(obj instanceof JsonNode)) {
            throw new JsonPathException("Not a JSON Node");
        }
        return toString();
    }
View Full Code Here

            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");
    }
View Full Code Here

TOP

Related Classes of com.jayway.jsonpath.JsonPathException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.