Package com.fasterxml.jackson.core

Examples of com.fasterxml.jackson.core.JsonLocation


     *     {@code null} if the entry is an 'is_deleted' entry.
     */
    public static <C> WithChildrenC<C> read(JsonParser parser, Collector<DbxEntry, ? extends C> collector)
        throws IOException, JsonReadException
    {
        JsonLocation top = JsonReader.expectObjectStart(parser);

        String size = null;
        long bytes = -1;
        String path = null;
        Boolean is_dir = null;
View Full Code Here


            }
        }

        @Override
        public Object deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
            JsonLocation currentLocation = jp.getCurrentLocation();
            Object o = deserializer.deserialize(jp, ctxt);
            locations.addLocation(o, currentLocation, jp.getCurrentLocation());
            return o;
        }
View Full Code Here

            restxResponse.setStatus(HttpStatus.BAD_REQUEST);
            restxResponse.setContentType("text/plain");
            PrintWriter out = restxResponse.getWriter();
            if (restxRequest.getContentStream() instanceof BufferedInputStream) {
                try {
                    JsonLocation location = ex.getLocation();
                    restxRequest.getContentStream().reset();
                    out.println(CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, ex.getClass().getSimpleName()) + "." +
                            " Please verify your input:");
                    List<String> lines = CharStreams.readLines(
                            new InputStreamReader(restxRequest.getContentStream()));

                    if (lines.isEmpty()) {
                        if ("application/x-www-form-urlencoded".equalsIgnoreCase(restxRequest.getContentType())) {
                            out.println("Body was considered as parameter due to Content-Type: " +
                                    restxRequest.getContentType() + ". " +
                                    "Setting your Content-Type to \"application/json\" may resolve the problem");
                        } else {
                            out.println("Empty body. Content-type was \"" + restxRequest.getContentType() + "\"");
                        }
                    } else {
                        out.println("<-- JSON -->");
                        for (int i = 0; i < lines.size(); i++) {
                            String line = lines.get(i);
                            out.println(line);
                            if (location != null && (i + 1 == location.getLineNr())) {
                                boolean farColumn = location.getColumnNr() > 80;
                                /*
                                 * if error column is too far, we precede the error message with >> to show
                                 * that there is an error message on the line
                                 */
                                out.println(
                                        Strings.repeat(" ", Math.max(0, location.getColumnNr() - 2)) + "^");
                                out.println(Strings.repeat(farColumn ? ">" : " ", Math.max(0, location.getColumnNr()
                                        - (ex.getOriginalMessage().length() / 2) - 3))
                                        + ">> " + ex.getOriginalMessage() + " <<");
                                out.println();
                            }
                        }
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.core.JsonLocation

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.