Package com.fasterxml.jackson.core

Examples of com.fasterxml.jackson.core.JsonParseException


    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.FIELD_NAME );
    String currentName = parserWrapper.getCurrentName();

    if ( !PROPERTY_NAME.equals( currentName ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_NAME + "> but was <" + currentName + ">", parserWrapper.getCurrentLocation() );
    }
    parserWrapper.nextToken();
    String name = parserWrapper.getText();
    //version
    Version version = deserialize( Version.class, PROPERTY_VERSION, formatVersion, deserializeFrom );
View Full Code Here


      Link link;

      // links is an object, so we parse till we find its end.
      while (!JsonToken.END_OBJECT.equals(jp.nextToken())) {
        if (!JsonToken.FIELD_NAME.equals(jp.getCurrentToken())) {
          throw new JsonParseException("Expected relation name", jp.getCurrentLocation());
        }

        // save the relation in case the link does not contain it
        relation = jp.getText();
View Full Code Here

      Object object;

      // links is an object, so we parse till we find its end.
      while (!JsonToken.END_OBJECT.equals(jp.nextToken())) {
        if (!JsonToken.FIELD_NAME.equals(jp.getCurrentToken())) {
          throw new JsonParseException("Expected relation name", jp.getCurrentLocation());
        }

        if (JsonToken.START_ARRAY.equals(jp.nextToken())) {
          while (!JsonToken.END_ARRAY.equals(jp.nextToken())) {
            object = deser.deserialize(jp, ctxt);
View Full Code Here

    {
        checkNotNull(jsonInput, "jsonInput is null");
        try (JsonParser jsonParser = JSON_FACTORY.createJsonParser(jsonInput.getInput())) {
            // Initialize by advancing to first token and make sure it exists
            if (jsonParser.nextToken() == null) {
                throw new JsonParseException("Missing starting token", jsonParser.getCurrentLocation());
            }

            return jsonExtractor.extract(jsonParser);
        }
    }
View Full Code Here

        @Override
        public Slice extract(JsonParser jsonParser)
                throws IOException
        {
            if (jsonParser.getCurrentToken() != START_OBJECT) {
                throw new JsonParseException("Expected a Json object", jsonParser.getCurrentLocation());
            }

            while (!jsonParser.nextFieldName(fieldName)) {
                if (!jsonParser.hasCurrentToken()) {
                    throw new JsonParseException("Unexpected end of object", jsonParser.getCurrentLocation());
                }
                if (jsonParser.getCurrentToken() == END_OBJECT) {
                    // Unable to find matching field
                    return null;
                }
View Full Code Here

        @Override
        public Slice extract(JsonParser jsonParser)
                throws IOException
        {
            if (jsonParser.getCurrentToken() != START_ARRAY) {
                throw new JsonParseException("Expected a Json array", jsonParser.getCurrentLocation());
            }

            int currentIndex = 0;
            while (true) {
                JsonToken token = jsonParser.nextToken();
                if (token == null) {
                    throw new JsonParseException("Unexpected end of array", jsonParser.getCurrentLocation());
                }
                if (token == END_ARRAY) {
                    // Index out of bounds
                    return null;
                }
View Full Code Here

        public Slice extract(JsonParser jsonParser)
                throws IOException
        {
            JsonToken token = jsonParser.getCurrentToken();
            if (token == null) {
                throw new JsonParseException("Unexpected end of value", jsonParser.getCurrentLocation());
            }
            if (!token.isScalarValue() || token == VALUE_NULL) {
                return null;
            }
            return Slices.wrappedBuffer(jsonParser.getText().getBytes(Charsets.UTF_8));
View Full Code Here

        @Override
        public Slice extract(JsonParser jsonParser)
                throws IOException
        {
            if (!jsonParser.hasCurrentToken()) {
                throw new JsonParseException("Unexpected end of value", jsonParser.getCurrentLocation());
            }

            DynamicSliceOutput dynamicSliceOutput = new DynamicSliceOutput(ESTIMATED_JSON_OUTPUT_SIZE);
            try (JsonGenerator jsonGenerator = JSON_FACTORY.createJsonGenerator(dynamicSliceOutput)) {
                jsonGenerator.copyCurrentStructure(jsonParser);
View Full Code Here

    public JsonToken nextToken() throws IOException
    {
        if (_currentReader == null) {
            int index = _decoder.readIndex();
            if (index < 0 || index >= _memberReaders.length) {
                throw new JsonParseException("Invalid index ("+index+"); union only has "
                        +_memberReaders.length+" types",
                        _parser.getCurrentLocation());
            }
            // important: remember to create new instance
            // also: must pass our parent (not this instance)
View Full Code Here

        protected JsonToken readValue(AvroParserImpl parser, BinaryDecoder decoder)
            throws IOException
        {
            int index = decoder.readIndex();
            if (index < 0 || index >= _readers.length) {
                throw new JsonParseException("Invalid index ("+index+"); union only has "
                        +_readers.length+" types",
                        parser.getCurrentLocation());
            }
            return _readers[index].readValue(parser, decoder);
        }
View Full Code Here

TOP

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

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.