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_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> 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

  } else if (node.has("cents")) {
      cents = node.get("cents").longValue();
  }

  if (currency == null || (amount == null && cents == null)) {
      throw new JsonParseException("Wrong format for Money", jsonParser.getCurrentLocation());
  }

  try {
      if (amount != null) {
    result = Money.of(CurrencyUnit.of(currency), new BigDecimal(amount));
      } else {
    result = Money.ofMinor(CurrencyUnit.of(currency), cents);
      }
  } catch (Exception ex) {
      throw new JsonParseException("Could not construct Money from arguments",
        jsonParser.getCurrentLocation(), ex);
  }

  return result;
View Full Code Here

      {
         return UriTemplate.fromTemplate(value);
      }
      catch (MalformedUriTemplateException e)
      {
         throw new JsonParseException("Error parsing the URI Template", parser.getCurrentLocation(), e);
      }
   }
View Full Code Here

  public void nextField( @Nonnull String fieldName ) throws IOException {
    nextToken( JsonToken.FIELD_NAME );
    String currentName = parser.getCurrentName();

    if ( !fieldName.equals( currentName ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + fieldName + "> but was <" + currentName + ">", parser.getCurrentLocation() );
    }
  }
View Full Code Here

  }

  public void verifyCurrentToken( @Nonnull JsonToken expected ) throws JsonParseException {
    JsonToken current = parser.getCurrentToken();
    if ( current != expected ) {
      throw new JsonParseException( "Invalid token. Expected <" + expected + "> but got <" + current + ">", parser.getCurrentLocation() );
    }
  }
View Full Code Here

  public void ensureObjectClosed() throws JsonParseException {
    JacksonParserWrapper parserWrapper = new JacksonParserWrapper( parser );

    if ( parserWrapper.getCurrentToken() != JsonToken.END_OBJECT ) {
      throw new JsonParseException( "No consumed everything " + parserWrapper.getCurrentToken(), parserWrapper.getCurrentLocation() );
    }
  }
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.