Package com.fasterxml.jackson.core

Examples of com.fasterxml.jackson.core.JsonParseException


  }

  public void ensureParserClosed() throws IOException {
    JacksonParserWrapper parserWrapper = new JacksonParserWrapper( parser );
    if ( parserWrapper.nextToken() != null ) {
      throw new JsonParseException( "No consumed everything " + parserWrapper.getCurrentToken(), parserWrapper.getCurrentLocation() );
    }

    parserWrapper.close();
  }
View Full Code Here


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

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

    if ( type == null ) {
      throw new JsonParseException( "Attribute" + PROPERTY_SUB_TYPE + " not found. Cannot find strategy.", deserializeFrom.getCurrentLocation() );
    }

    SerializingStrategy<? extends T, JsonGenerator, JsonParser, JsonProcessingException, OutputStream, InputStream> strategy = serializingStrategySupport.findStrategy( type );
    Version resolvedVersion = serializingStrategySupport.resolveVersion( strategy, formatVersion );
    return strategy.deserialize( deserializeFrom, resolvedVersion );
View Full Code Here

      T deserialized = deserializeInternal( parser, version );

      JacksonParserWrapper parserWrapper = new JacksonParserWrapper( parser );
      if ( parserWrapper.nextToken() != null ) {
        throw new JsonParseException( "No consumed everything " + parserWrapper.getCurrentToken(), parserWrapper.getCurrentLocation() );
      }

      parserWrapper.close();
      return deserialized;
    } catch ( InvalidTypeException e ) {
View Full Code Here

    T deserialized = deserialize( parser, version );

    if ( isObjectType() ) {
      if ( parserWrapper.getCurrentToken() != JsonToken.END_OBJECT ) {
        throw new JsonParseException( "No consumed everything " + parserWrapper.getCurrentToken(), parserWrapper.getCurrentLocation() );
      }
    }

    return deserialized;
  }
View Full Code Here

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

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

    List<T> deserialized = new ArrayList<T>();
View Full Code Here

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

    if ( !propertyName.equals( currentName ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + propertyName + "> but was <" + currentName + ">", parserWrapper.getCurrentLocation() );
    }
    parserWrapper.nextToken();
    return deserialize( type, formatVersion, deserializeFrom );
  }
View Full Code Here

      writeData(writer.rootAsList());
      break;
    case NOT_AVAILABLE:
      return false;
    default:
      throw new JsonParseException(
          String.format("Failure while parsing JSON.  Found token of [%s]  Drill currently only supports parsing "
              + "json strings that contain either lists or maps.  The root object cannot be a scalar.",
              t),
          parser.getCurrentLocation());
    }
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

    {
        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 T 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

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.