Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.JsonMappingException


            }
            return new com.mongodb.DBRef(null, dbRef.getCollectionName(), id);
        } else if (value instanceof ObjectId) {
            return value;
        } else {
            throw new JsonMappingException("Cannot deserialise object of type "
                    + value.getClass() + " to ObjectId");
        }
    }
View Full Code Here


    public JsonDeserializer<?> findBeanDeserializer(JavaType type,
            DeserializationConfig config, BeanDescription beanDesc)
            throws JsonMappingException {
        if (type.getRawClass() == DBRef.class) {
            if (type.containedTypeCount() != 2) {
                throw new JsonMappingException(
                        "Property doesn't declare object and key type");
            }
            JavaType objectType = type.containedType(0);
            JavaType keyType = type.containedType(1);
            return new DBRefDeserializer(objectType, keyType);
View Full Code Here

    try {
      accessToken.getScope().add(null);
    }
    catch (NullPointerException e) {
      // short circuit NPE from Java 7 (which is correct but only relevant for this test)
      throw new JsonMappingException("Scopes cannot be null or empty. Got [null]");
    }
    mapper.writeValueAsString(accessToken);
  }
View Full Code Here

        BucketPropertiesBuilder builder = new BucketPropertiesBuilder();
        JsonNode props = root.path(Constants.FL_SCHEMA);

        if (props.isMissingNode()) {
            throw new JsonMappingException("no 'props' field found");
        }

        builder.allowSiblings(props.path(Constants.FL_SCHEMA_ALLOW_MULT).asBoolean());
        builder.lastWriteWins(props.path(Constants.FL_SCHEMA_LAST_WRITE_WINS).asBoolean());
        builder.nVal(props.path(Constants.FL_SCHEMA_NVAL).asInt());
View Full Code Here

                return null; // "additionalProperties":true is the default
            } else {
                return ObjectSchema.NoAdditionalProperties.instance;
            }
        } else {
            throw new JsonMappingException("additionalProperties nodes can only be of "
                    + "type boolean or object: " + nodeStr);
        }
    }
View Full Code Here

      if (booleanNode.booleanValue()) {
        return null; // "additionalItems":true is the default
      }
      return new ArraySchema.NoAdditionalItems();
    }
    throw new JsonMappingException("additionalItems nodes can only be of "
            + "type Boolean or Object; instead found something starting with token " + node.asToken());
  }
View Full Code Here

    }

    @GET
    @Path("json-mapping-exception")
    public void jsonMappingException() throws JsonMappingException {
        throw new JsonMappingException("BOOM");
    }
View Full Code Here

        }
        try {
            @SuppressWarnings("unchecked") T map = (T) creatorMethod.invoke(null, multimap);
            return map;
        } catch (InvocationTargetException e) {
            throw new JsonMappingException("Could not map to " + type, _peel(e));
        } catch (IllegalArgumentException e) {
            throw new JsonMappingException("Could not map to " + type, _peel(e));
        } catch (IllegalAccessException e) {
            throw new JsonMappingException("Could not map to " + type, _peel(e));
        }
    }
View Full Code Here

        }
    }

    private void expect(JsonParser jp, JsonToken token) throws IOException {
        if (jp.getCurrentToken() != token) {
            throw new JsonMappingException("Expecting " + token + ", found " + jp.getCurrentToken(),
                    jp.getCurrentLocation());
        }
    }
View Full Code Here

            //}
        } catch (Exception e) {
            String name = (i == props.length) ? "[anySetter]" : props[i].getName();
            wrapAndThrow(provider, e, bean, name);
        } catch (StackOverflowError e) {
            JsonMappingException mapE = new JsonMappingException("Infinite recursion (StackOverflowError)", e);
            String name = (i == props.length) ? "[anySetter]" : props[i].getName();
            mapE.prependPath(new JsonMappingException.Reference(bean, name));
            throw mapE;
        }
    }
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.databind.JsonMappingException

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.