Package com.fasterxml.jackson.core

Examples of com.fasterxml.jackson.core.JsonParseException


        @Override
        public T 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

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

            if (jsonParser.getCurrentToken() == START_ARRAY) {
                long length = 0;
                while (true) {
View Full Code Here

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

    if ( !PROPERTY_DELIMITER.equals( currentName1 ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_DELIMITER + "> but was <" + currentName1 + ">", parserWrapper.getCurrentLocation() );
    }
    parserWrapper.nextToken();
    String delimiter = parserWrapper.getText();
    //extension
    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.FIELD_NAME );
    String currentName = parserWrapper.getCurrentName();

    if ( !PROPERTY_EXTENSION.equals( currentName ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_EXTENSION + "> but was <" + currentName + ">", parserWrapper.getCurrentLocation() );
    }
    parserWrapper.nextToken();
    String extension = parserWrapper.getText();
    //Finally closing element
    parserWrapper.nextToken( JsonToken.END_OBJECT );
View Full Code Here

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

    if ( !PROPERTY_MIN.equals( currentName3 ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_MIN + "> but was <" + currentName3 + ">", parserWrapper.getCurrentLocation() );
    }
    parserWrapper.nextToken();
    Version min = Version.parse( deserializeFrom.getText() );
    //max
    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.FIELD_NAME );
    String currentName2 = parserWrapper.getCurrentName();

    if ( !PROPERTY_MAX.equals( currentName2 ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_MAX + "> but was <" + currentName2 + ">", parserWrapper.getCurrentLocation() );
    }
    parserWrapper.nextToken();
    Version max = Version.parse( deserializeFrom.getText() );
    //includeLower
    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.FIELD_NAME );
    String currentName1 = parserWrapper.getCurrentName();

    if ( !PROPERTY_INCLUDELOWER.equals( currentName1 ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_INCLUDELOWER + "> but was <" + currentName1 + ">", parserWrapper.getCurrentLocation() );
    }
    parserWrapper.nextToken();
    boolean includeLower = deserializeFrom.getBooleanValue();
    //includeUpper
    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.FIELD_NAME );
    String currentName = parserWrapper.getCurrentName();

    if ( !PROPERTY_INCLUDEUPPER.equals( currentName ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_INCLUDEUPPER + "> but was <" + currentName + ">", parserWrapper.getCurrentLocation() );
    }
    parserWrapper.nextToken();
    boolean includeUpper = deserializeFrom.getBooleanValue();
    //Finally closing element
    parserWrapper.nextToken( JsonToken.END_OBJECT );
View Full Code Here

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

    if ( !PROPERTY_RED.equals( currentName2 ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_RED + "> but was <" + currentName2 + ">", parserWrapper.getCurrentLocation() );
    }
    parserWrapper.nextToken();
    int red = parserWrapper.getIntValue();

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

    if ( !PROPERTY_GREEN.equals( currentName1 ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_GREEN + "> but was <" + currentName1 + ">", parserWrapper.getCurrentLocation() );
    }
    parserWrapper.nextToken();
    int green = parserWrapper.getIntValue();

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

    if ( !PROPERTY_BLUE.equals( currentName ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_BLUE + "> but was <" + currentName + ">", parserWrapper.getCurrentLocation() );
    }
    parserWrapper.nextToken();
    int blue = parserWrapper.getIntValue();

    parserWrapper.nextToken( JsonToken.END_OBJECT );
View Full Code Here

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

      if ( !PROPERTY_ID.equals( currentName ) ) {
        throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_ID + "> but was <" + currentName + ">", parserWrapper.getCurrentLocation() );
      }
    }

    //id
    assert deserializeFrom.getCurrentName().equals( PROPERTY_ID );
    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.VALUE_STRING );
    String id = deserializeFrom.getText();
    //name
    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.FIELD_NAME );
    String currentName1 = parserWrapper.getCurrentName();

    if ( !PROPERTY_NAME.equals( currentName1 ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_NAME + "> but was <" + currentName1 + ">", parserWrapper.getCurrentLocation() );
    }
    parserWrapper.nextToken();
    String name = deserializeFrom.getText();
    //url
    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.FIELD_NAME );
    String currentName = parserWrapper.getCurrentName();

    if ( !PROPERTY_URL.equals( currentName ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_URL + "> but was <" + currentName + ">", parserWrapper.getCurrentLocation() );
    }
    JsonToken token = deserializeFrom.nextToken();
    @Nullable URL url;
    if ( token == JsonToken.VALUE_NULL ) {
      url = null;
View Full Code Here

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

    if ( !PROPERTY_ALGORITHM.equals( currentName1 ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_ALGORITHM + "> but was <" + currentName1 + ">", parserWrapper.getCurrentLocation() );
    }
    parserWrapper.nextToken();
    Algorithm algorithm = Algorithm.getAlgorithm( deserializeFrom.getText() );

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

    if ( !PROPERTY_VALUE.equals( currentName ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_VALUE + "> but was <" + currentName + ">", parserWrapper.getCurrentLocation() );
    }
    parserWrapper.nextToken();
    String hex = deserializeFrom.getText();

    parserWrapper.nextToken( JsonToken.END_OBJECT );
View Full Code Here

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

    if ( !PROPERTY_ID.equals( currentName2 ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_ID + "> but was <" + currentName2 + ">", parserWrapper.getCurrentLocation() );
    }
    parserWrapper.nextToken();
    String id = parserWrapper.getText();
    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.FIELD_NAME );
    String currentName1 = parserWrapper.getCurrentName();

    if ( !PROPERTY_DEPENDENT_TYPE.equals( currentName1 ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_DEPENDENT_TYPE + "> but was <" + currentName1 + ">", parserWrapper.getCurrentLocation() );
    }
    parserWrapper.nextToken();
    boolean dependentType = parserWrapper.getBooleanValue();
    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.FIELD_NAME );
    String currentName = parserWrapper.getCurrentName();

    if ( !PROPERTY_CONTENT_TYPE.equals( currentName ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_CONTENT_TYPE + "> but was <" + currentName + ">", parserWrapper.getCurrentLocation() );
    }
    parserWrapper.nextToken();
    String contentType = parserWrapper.getText();
    List<? extends Extension> extensions = deserializeArray( Extension.class, PROPERTY_EXTENSIONS, deserializeFrom, formatVersion );
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.