Examples of JsonParseException


Examples of org.apache.jena.atlas.json.JsonParseException

            //        //<EOF> test : EOF is always token 0.
            //        if ( p.token_source.getNextToken().kind != 0 )
            //            throw new JSONParseException("Trailing characters after "+item, item.getLine(), item.getColumn()) ;
        }
        catch (ParseException ex)
        { throw new JsonParseException(ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginColumn) ; }
        catch (TokenMgrError tErr)
        {
            // Last valid token : not the same as token error message - but this should not happen
            int col = p.token.endColumn ;
            int line = p.token.endLine ;
            throw new JsonParseException(tErr.getMessage(), line, col) ;
        }
    }
View Full Code Here

Examples of org.apache.jena.atlas.json.JsonParseException

        try
        {
            p.any() ;
        }
        catch (ParseException ex)
        { throw new JsonParseException(ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginColumn) ; }
        catch (TokenMgrError tErr)
        {
            // Last valid token : not the same as token error message - but this should not happen
            int col = p.token.endColumn ;
            int line = p.token.endLine ;
            throw new JsonParseException(tErr.getMessage(), line, col) ;
        }
    }
View Full Code Here

Examples of org.apache.jena.atlas.json.JsonParseException

            exception(msg) ;
        nextToken() ;
    }

    final protected void exception(String msg, Object... args)
    { throw new JsonParseException(String.format(msg, args),
                                    (int)tokens.getLine(),
                                    (int)tokens.getColumn()) ; }
View Full Code Here

Examples of org.codehaus.jackson.JsonParseException

    JsonNode rootNode = parseLocationField(locationField);
    JsonNode pathNode = rootNode.path(path);
    Set<String> url = new HashSet<String>();
    if (pathNode.isMissingNode()){
     
      throw new JsonParseException("The Object '" + path + "' could not be found.", null);
     
    } else if (pathNode.isArray()){
     
      ArrayNode urls = (ArrayNode) rootNode.path(path);
      for(JsonNode currentUrl: urls){
        url.add(currentUrl.getTextValue());
      }
     
    } else if (pathNode.isTextual()){
      url.add(pathNode.getTextValue());
    }

    if (url == null || url.isEmpty()){
     
      throw new JsonParseException("The Object '" + path + "' is empty.", null);

    }
    List<String> urlList = new ArrayList<String>();
    urlList.addAll(url);
    return urlList;
View Full Code Here

Examples of org.codehaus.jackson.JsonParseException

    }

    private void validateText(JsonParser jsonParser, String input) throws JsonProcessingException {
        Matcher m = textPattern.matcher(input);
        if (!m.matches()) {
            throw new JsonParseException("Unexpected token: " + input, jsonParser.getTokenLocation());
        }
    }
View Full Code Here

Examples of org.codehaus.jackson.JsonParseException

        }
    }

    private void validate(JsonParser jsonParser, String input, String expected) throws JsonProcessingException {
        if (!input.equals(expected)) {
            throw new JsonParseException("Unexpected token: " + input, jsonParser.getTokenLocation());
        }
    }
View Full Code Here

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

Examples of org.codehaus.jackson.JsonParseException

  }

  @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

Examples of org.codehaus.jackson.JsonParseException

  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

Examples of org.codehaus.jackson.JsonParseException

  @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
TOP
Copyright © 2018 www.massapi.com. 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.