private void reportIllegal(JsonParser parser, JsonToken expToken) throws IOException {
   JsonToken curr = parser.getCurrentToken();
   String msg = "Expected token " + expToken + "; got " + curr;
   if (curr == JsonToken.FIELD_NAME) {
     msg += " (current field name '" + parser.getCurrentName() + "')";
   }
   msg += ", location: " + parser.getTokenLocation();
   throw new IllegalStateException(msg);
 }
Esempio n. 2
0
 @Override
 public JSONOptions deserialize(JsonParser jp, DeserializationContext ctxt)
     throws IOException, JsonProcessingException {
   JsonLocation l = jp.getTokenLocation();
   //      logger.debug("Reading tree.");
   TreeNode n = jp.readValueAsTree();
   //      logger.debug("Tree {}", n);
   if (n instanceof JsonNode) {
     return new JSONOptions((JsonNode) n, l);
   } else {
     throw new IllegalArgumentException(
         String.format("Received something other than a JsonNode %s", n));
   }
 }