Package org.codehaus.jackson.map

Examples of org.codehaus.jackson.map.JsonMappingException$Reference


    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


            if (origMsg != null) {
                msg.append(", problem: ").append(origMsg);
            } else {
                msg.append(" (no error message provided)");
            }
            throw new JsonMappingException(msg.toString(), null, e);
        }
        if (e instanceof IOException) {
            throw (IOException) e;
        }
        if (e instanceof RuntimeException) {
            throw (RuntimeException) e;
        }
        // let's wrap the innermost problem
        Throwable t = e;
        while (t.getCause() != null) {
            t = t.getCause();
        }
        throw new JsonMappingException(t.getMessage(), null, t);
    }
View Full Code Here

    }

    protected void _reportSelfReference(Object bean)
        throws JsonMappingException
    {
        throw new JsonMappingException("Direct self-reference leading to cycle");
    }
View Full Code Here

                        if (i > 0) {
                            s.append(", ");
                        }
                        s.append(views[i].getName());
                    }
                    throw new JsonMappingException(s.toString());
                }
                return views[0];
            }
        }
        return null;
View Full Code Here

    {
        Object adapted;
        try {
            adapted = this.xmlAdapter.marshal(value);
        } catch (Exception e) {
            throw new JsonMappingException("Unable to marshal: "+e.getMessage(), e);
        }
        if (adapted == null) {
            provider.getNullValueSerializer().serialize(null, jgen, provider);
        } else {
            Class<?> c = adapted.getClass();
View Full Code Here

            throws IOException
    {
        String ns = jsonNode.get("namespace") != null ? jsonNode.get("namespace").asText() : null;
        String name = jsonNode.get("name") != null ? jsonNode.get("name").asText() : null;
        if (name == null) {
            throw new JsonMappingException("No name for DOM element was provided in the JSON object.");
        }
        Element element = document.createElementNS(ns, name);

        JsonNode attributesNode = jsonNode.get("attributes");
        if (attributesNode != null && attributesNode instanceof ArrayNode) {
View Full Code Here

    }

    public JsonDeserializer<?> findBeanDeserializer(JavaType type, DeserializationConfig config, DeserializerProvider provider, BeanDescription beanDesc, BeanProperty property) throws JsonMappingException {
        if (type.getRawClass() == DBRef.class) {
            if (!type.hasGenericTypes()) {
                throw new JsonMappingException("Property " + 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

            }
            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

    }

    protected void _reportSelfReference(Object bean)
        throws JsonMappingException
    {
        throw new JsonMappingException("Direct self-reference leading to cycle");
    }
View Full Code Here

        }
        // and finally, empty Strings might be accepted as null Object...
        if (_cfgEmptyStringsAsObjects && value.length() == 0) {
            return null;
        }
        throw new JsonMappingException("Can not instantiate value of type "+getValueTypeDesc()
                +" from JSON String; no single-String constructor/factory method");
    }
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.map.JsonMappingException$Reference

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.