Package org.codehaus.jackson

Examples of org.codehaus.jackson.JsonParseException


  }

  @Deprecated
  public static void ensureObjectClosed( @Nonnull JsonParser parser ) throws JsonParseException {
    if ( parser.getCurrentToken() != JsonToken.END_OBJECT ) {
      throw new JsonParseException( "No consumed everything " + parser.getCurrentToken(), parser.getCurrentLocation() );
    }
  }
View Full Code Here


  }

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

    parser.close();
  }
View Full Code Here

  public static void nextField( @Nonnull JsonParser parser, @Nonnull String fieldName ) throws IOException {
    nextToken( parser, 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

  @Deprecated
  public static void verifyCurrentToken( @Nonnull JsonParser parser, @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 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 parse(File file, String content, Diagnostic chain) throws JsonParseException, IOException {
    JElement root = parse(file, content);
    if(!(root instanceof JObject))
      throw new JsonParseException("Excpected Json Object", JsonLocation.NA);

    ModuleName fullName = null;
    boolean nameSeen = false;
    boolean versionSeen = false;
View Full Code Here

          return new JObject(loc.getSourceRef(), pos, entries);
        case FIELD_NAME:
          entries.add(parseField());
          continue;
        default:
          throw new JsonParseException("Field name expected", jp.getTokenLocation());
      }
    }
  }
View Full Code Here

        }
        long endPos = jp.getCurrentLocation().getCharOffset();
        int[] pos = adjustPosition(line, (int) startPos, (int) (endPos - startPos));
        return new JPrimitive(loc.getSourceRef(), pos, value);
      default:
        throw new JsonParseException("Value expected", loc);
    }
  }
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.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.