Examples of JsonLocation


Examples of com.fasterxml.jackson.core.JsonLocation

            }

            public static <MD extends DbxDataObject> Entry<MD> extract(JsonParser parser, JsonExtractor<MD> metadataExtractor)
                throws IOException, JsonExtractionException
            {
                JsonLocation arrayStart = JsonExtractor.expectArrayStart(parser);

                if (JsonExtractor.isArrayEnd(parser)) {
                    throw new JsonExtractionException("expecting a two-element array of [path, metadata], found a zero-element array", arrayStart);
                }
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonLocation

    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

Examples of com.fasterxml.jackson.core.JsonLocation

        return rootMessage;
    }

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

Examples of com.fasterxml.jackson.core.JsonLocation

        this.fieldDefaults = src.fieldDefaults;
    }

    @Override
    public Object deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
        JsonLocation currentLocation = jp.getTokenLocation();
        JsonToken t = jp.getCurrentToken();
        try {
            if (t == JsonToken.START_OBJECT) {
                ObjectNode objectNode = jp.readValueAsTree();
                handleDefaultsAndRequiredAndNull(ctxt, objectNode);
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonLocation

            }
        }
        String classField = pluginMap.classField();
        JsonToken currentToken = jp.getCurrentToken();
        // 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

Examples of com.fasterxml.jackson.core.JsonLocation

        ConfigValue current = currentConfig();
        if (current == null) {
            return JsonLocation.NA;
        }
        ConfigOrigin nodeOrigin = current.origin();
        return new JsonLocation(current, -1, nodeOrigin.lineNumber(), -1);
    }
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonLocation

        return new CodecBeanDeserializer((BeanDeserializerBase) newDelegatee, fieldDefaults);
    }

    @Override
    public Object deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
        JsonLocation currentLocation = jp.getTokenLocation();
        JsonToken t = jp.getCurrentToken();
        try {
            if (t == JsonToken.START_OBJECT) {
                ObjectNode objectNode = jp.readValueAsTree();
                handleDefaultsAndRequiredAndNull(ctxt, objectNode);
View Full Code Here

Examples of javax.json.stream.JsonLocation

        reader.close();
        bufferPool.recycle(buf);
    }

    private JsonParsingException unexpectedChar(int ch) {
        JsonLocation location = getLastCharLocation();
        return new JsonParsingException(
            JsonMessages.TOKENIZER_UNEXPECTED_CHAR(ch, location), location);
    }
View Full Code Here

Examples of org.codehaus.jackson.JsonLocation

                                    final String value = getPrimitiveFieldValue(parser.nextToken(), parser.getText());
                                    eventQueue.add(new CharactersEvent(value, new StaxLocation(parser.getCurrentLocation())));
                                } else {
                                    // element event
                                    final QName elementName = getElementQName(fieldName);
                                    final JsonLocation currentLocation = parser.getCurrentLocation();

                                    final boolean isRootEmpty = isEmptyElement(fieldName, true);
                                    if (isRootEmpty) {
                                        eventQueue.add(createStartElementEvent(elementName, new StaxLocation(currentLocation)));
                                        eventQueue.add(createEndElementEvent(elementName, new StaxLocation(currentLocation)));
View Full Code Here

Examples of org.codehaus.jackson.JsonLocation

    {
        byte[] data = _smileDoc("[ true, null, false, 511 ]", true); // true -> write header
       
        JsonParser p = _smileParser(data);
        assertNull(p.getCurrentToken());
        JsonLocation loc = p.getCurrentLocation();
        assertNotNull(loc);
        // first: -1 for "not known", for character-based stuff
        assertEquals(-1, loc.getCharOffset());
        // except that with 1.9.7 and above, we also consider column to be same as offset, for convenience
        assertEquals(4, loc.getColumnNr());
        assertEquals(-1, loc.getLineNr());
        // but first 4 bytes are for header
        assertEquals(4, loc.getByteOffset());

        // array marker is a single byte, so:
        assertToken(JsonToken.START_ARRAY, p.nextToken());
        assertEquals(5, p.getCurrentLocation().getByteOffset());
        assertEquals(4, p.getTokenLocation().getByteOffset());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.