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


     *     {@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

    }
   
    private JsonLocation _extractLocation(XMLStreamLocation2 location)
    {
        if (location == null) { // just for impls that might pass null...
            return new JsonLocation(_sourceReference, -1, -1, -1);
        }
        return new JsonLocation(_sourceReference,
                location.getCharacterOffset(),
                location.getLineNumber(),
                location.getColumnNumber());
    }
View Full Code Here

    }
  }

  private static JsonNode buildParsingError(final JsonProcessingException e,
      final boolean crlf) {
    final JsonLocation location = e.getLocation();
    final ObjectNode ret = JsonNodeFactory.instance.objectNode();

    /*
     * Unfortunately, for some reason, Jackson botches the column number in
     * its JsonPosition -- I cannot figure out why exactly. However, it does
     * have a correct offset into the buffer.
     *
     * The problem is that if the input has CR/LF line terminators, its
     * offset will be "off" by the number of lines minus 1 with regards to
     * what JavaScript sees as positions in text areas. Make the necessary
     * adjustments so that the caret jumps at the correct position in this
     * case.
     */
    final int lineNr = location.getLineNr();
    int offset = (int) location.getCharOffset();
    if (crlf)
      offset = offset - lineNr + 1;
    ret.put(ParseError.LINE, lineNr);
    ret.put(ParseError.OFFSET, offset);

View Full Code Here

    }

    private static JsonNode buildParsingError(final JsonProcessingException e,
        final boolean crlf)
    {
        final JsonLocation location = e.getLocation();
        final ObjectNode ret = JsonNodeFactory.instance.objectNode();

        /*
         * Unfortunately, for some reason, Jackson botches the column number in
         * its JsonPosition -- I cannot figure out why exactly. However, it does
         * have a correct offset into the buffer.
         *
         * The problem is that if the input has CR/LF line terminators, its
         * offset will be "off" by the number of lines minus 1 with regards to
         * what JavaScript sees as positions in text areas. Make the necessary
         * adjustments so that the caret jumps at the correct position in this
         * case.
         */
        final int lineNr = location.getLineNr();
        int offset = (int) location.getCharOffset();
        if (crlf)
            offset = offset - lineNr + 1;
        ret.put(ParseError.LINE, lineNr);
        ret.put(ParseError.OFFSET, offset);

View Full Code Here

            };
        }

        @Override
        public Object createFromObjectWith(DeserializationContext ctxt, Object[] args) {
            return new JsonLocation(args[0], _long(args[1]), _long(args[2]),
                    _int(args[3]), _int(args[4]));
        }
View Full Code Here

                null, null, null, index, null, PropertyMetadata.STD_REQUIRED);
    }
   
    @Override
    public Object createFromObjectWith(DeserializationContext ctxt, Object[] args) {
        return new JsonLocation(args[0], _long(args[1]), _long(args[2]),
                _int(args[3]), _int(args[4]));
    }
View Full Code Here

    public static boolean isRealLocation(JsonLocation jsonLocation) {
        return (jsonLocation != null) && (jsonLocation != JsonLocation.NA);
    }

    public static JsonMappingException maybeImproveLocation(JsonLocation wrapLoc, JsonMappingException cause) {
        JsonLocation exLoc = cause.getLocation();
        if (isRealLocation(wrapLoc) && !isRealLocation(exLoc)) {
            if (wrapLoc.getSourceRef() instanceof ConfigValue) {
                ConfigValue locRef = (ConfigValue) wrapLoc.getSourceRef();
                List<JsonMappingException.Reference> paths = cause.getPath();
                for (JsonMappingException.Reference path : paths) {
View Full Code Here

        return rootMessage;
    }

    public static JsonLocation fromConfigValue(ConfigValue configValue) {
        ConfigOrigin configOrigin = configValue.origin();
        return new JsonLocation(configValue, -1, configOrigin.lineNumber(), -1);
    }
View Full Code Here

            if (typeId != null) {
                return _deserializeWithNativeTypeId(jp, ctxt, typeId);
            }
        }
        // can use this to approximate error location if a sub-method throws an exception
        JsonLocation currentLocation = jp.getTokenLocation();
        JsonNode jsonNode = jp.readValueAsTree();
        ObjectCodec objectCodec = jp.getCodec();

        try {
            Object bean = null;
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.