Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.JsonMappingException


         * in. At least that's not good in common case. However,
         * theoretically the case where we get JSON null might
         * be compatible. If so, implementation could be changed.
         */
        if (toModify == null) {
            throw new JsonMappingException("Problem deserializing 'setterless' property '"+getName()+"': get method returned null");
        }
        _valueDeserializer.deserialize(jp, ctxt, toModify);
    }
View Full Code Here


                String m2 = cause.getMessage();
                if (m2 != null) {
                    msg = msg + ", problem: "+m2;
                }
            }
            JsonMappingException e = ctxt.weirdStringException(text, _valueClass, msg);
            if (cause != null) {
                e.initCause(cause);
            }
            throw e;
            // nothing to do here, yet? We'll fail anyway
        }
        if (jp.getCurrentToken() == JsonToken.VALUE_EMBEDDED_OBJECT) {
View Full Code Here

            return;
        }

        // For [#501] fix we need to implement this but:
        if (_valueTypeDeserializer != null) {
            throw new JsonMappingException("Problem deserializing 'setterless' property (\""+getName()+"\"): no way to handle typed deser with setterless yet");
//            return _valueDeserializer.deserializeWithType(jp, ctxt, _valueTypeDeserializer);
        }
       
        // Ok: then, need to fetch Collection/Map to modify:
        Object toModify;
        try {
            toModify = _getter.invoke(instance);
        } catch (Exception e) {
            _throwAsIOE(e);
            return; // never gets here
        }
        /* Note: null won't work, since we can't then inject anything
         * in. At least that's not good in common case. However,
         * theoretically the case where we get JSON null might
         * be compatible. If so, implementation could be changed.
         */
        if (toModify == null) {
            throw new JsonMappingException("Problem deserializing 'setterless' property '"+getName()+"': get method returned null");
        }
        _valueDeserializer.deserialize(jp, ctxt, toModify);
    }
View Full Code Here

        } catch (Exception e) { // but wrap RuntimeExceptions, to get path information
            String msg = e.getMessage();
            if (msg == null) {
                msg = "[no message for "+e.getClass().getName()+"]";
            }
            throw new JsonMappingException(msg, e);
        }
        // end of super-class implementation

        if (asArray) {
            jgen.writeEndObject();
View Full Code Here

        } catch (Exception e) { // but others do need to be, to get path etc
            String msg = e.getMessage();
            if (msg == null) {
                msg = "[no message for "+e.getClass().getName()+"]";
            }
            throw new JsonMappingException(msg, e);
        }
        // end of super-class implementation

        if (asArray) {
            jgen.writeEndObject();
View Full Code Here

        } catch (Exception e) { // but others do need to be, to get path etc
            String msg = e.getMessage();
            if (msg == null) {
                msg = "[no message for "+e.getClass().getName()+"]";
            }
            throw new JsonMappingException(msg, e);
        }
        // end of super-class implementation
        if (asArray) {
            jgen.writeEndObject();
        }
View Full Code Here

    {
        // [Issue#71]: When converting, we actually get TokenBuffer, which is fine
        if (!(jgen instanceof ToXmlGenerator)) {
            // but verify
            if (!(jgen instanceof TokenBuffer)) {
                throw new JsonMappingException("XmlMapper does not with generators of type other than ToXmlGenerator; got: "
                            +jgen.getClass().getName());
                }
                return null;
        }
        return (ToXmlGenerator) jgen;
View Full Code Here

      Map<String, String> map = new HashMap<String, String>();

      JsonToken token;

      if ((token = jp.getCurrentToken()) != JsonToken.START_ARRAY)
        throw new JsonMappingException("expected start of array, but found " + token, jp.getCurrentLocation());

      while ((token = jp.nextToken()) == JsonToken.START_ARRAY) {
        map.put(jp.nextTextValue(), jp.nextTextValue());
        if ((token = jp.nextToken()) != JsonToken.END_ARRAY)
          throw new JsonMappingException("expected a 2-valued array, but next token was a " + token,
            jp.getCurrentLocation());
      }

      return map;
    }
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

      Map<String, String> map = new HashMap<String, String>();

      JsonToken token;

      if ((token = jp.getCurrentToken()) != JsonToken.START_ARRAY)
        throw new JsonMappingException("expected start of array, but found " + token, jp.getCurrentLocation());

      while((token = jp.nextToken()) == JsonToken.START_ARRAY) {
        map.put(jp.nextTextValue(), jp.nextTextValue());
        if((token = jp.nextToken()) != JsonToken.END_ARRAY)
          throw new JsonMappingException("expected a 2-valued array, but next token was a " + token, jp.getCurrentLocation());
      }

      return map;
    }
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.