Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.JsonMappingException


            if (objectNode.get(alias) != null) {
                if (matched != null) {
                    String message = String.format(
                            "no type specified, more than one key, and both %s and %s match for inlined types.",
                            matched, alias);
                    JsonMappingException exception = ctxt.instantiationException(_baseType.getRawClass(), message);
                    exception.prependPath(_baseType, matched);
                    throw exception;
                }
                matched = alias;
            }
        }
View Full Code Here


                                                    + "could be types for the _primary property %s whose category is "
                                                    + "%s. This is too ambiguous to resolve.",
                                                    possibleInlinedPrimary, fieldName, primaryField,
                                                    ((CodecTypeDeserializer) primaryTypeDeserializer)
                                                            .pluginMap.category());
                                            JsonMappingException ex =
                                                    ctxt.instantiationException(_baseType.getRawClass(), message);
                                            ex.prependPath(beanDeserializer.getValueType(), fieldName);
                                            throw ex;
                                        }
                                    }
                                }
                            }
View Full Code Here

         * 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

        }
    }

    public static IOException maybeUnwrapPath(String pathToSkip, IOException cause) {
        if ((pathToSkip != null) && (cause instanceof JsonMappingException)) {
            JsonMappingException mappingException = (JsonMappingException) cause;
            List<JsonMappingException.Reference> paths = mappingException.getPath();
            if (!paths.isEmpty()) {
                Iterator<String> pathIterator = dotSplitter.split(pathToSkip).iterator();
                Iterator<JsonMappingException.Reference> refIterator = paths.iterator();
                while (pathIterator.hasNext()) {
                    String pathToSkipPart = pathIterator.next();
                    if (!refIterator.hasNext()) {
                        return cause;
                    }
                    String nextRefField = refIterator.next().getFieldName();
                    if (!pathToSkipPart.equals(nextRefField)) {
                        return cause;
                    }
                }
                JsonMappingException unwrapped = new JsonMappingException(rootMessage(mappingException),
                                                                          mappingException.getLocation(),
                                                                          mappingException.getCause());
                if (refIterator.hasNext()) {
                    List<JsonMappingException.Reference> remainingRefs = Lists.newArrayList(refIterator);
                    for (JsonMappingException.Reference reference : Lists.reverse(remainingRefs)) {
                        unwrapped.prependPath(reference);
                    }
                }
                return unwrapped;
            }
        }
View Full Code Here

                    wrapLoc = fromConfigValue(locRef);
                }
            }
            List<JsonMappingException.Reference> paths = Lists.reverse(cause.getPath());
            if (!paths.isEmpty()) {
                JsonMappingException withLoc = new JsonMappingException(rootMessage(cause), wrapLoc, cause);
                for (JsonMappingException.Reference path : paths) {
                    withLoc.prependPath(path);
                }
                return withLoc;
            } else {
                return new JsonMappingException(rootMessage(cause), wrapLoc, cause);
            }
        }
        return cause;
    }
View Full Code Here

        } catch (Exception e) {
            throw wrapException(e);
        } catch (ExceptionInInitializerError e) {
            throw wrapException(e);
        }
        throw new JsonMappingException("Can not instantiate value of type "+getValueTypeDesc()
                +" from Integral number; no single-int-arg constructor/factory method");
    }
View Full Code Here

        } catch (Exception e) {
            throw wrapException(e);
        } catch (ExceptionInInitializerError e) {
            throw wrapException(e);
        }
        throw new JsonMappingException("Can not instantiate value of type "+getValueTypeDesc()
                +" from Long integral number; no single-long-arg constructor/factory method");
    }
View Full Code Here

        } catch (Exception e) {
            throw wrapException(e);
        } catch (ExceptionInInitializerError e) {
            throw wrapException(e);
        }
        throw new JsonMappingException("Can not instantiate value of type "+getValueTypeDesc()
                +" from Floating-point number; no one-double/Double-arg constructor/factory method");
    }
View Full Code Here

        } catch (Exception e) {
            throw wrapException(e);
        } catch (ExceptionInInitializerError e) {
            throw wrapException(e);
        }
        throw new JsonMappingException("Can not instantiate value of type "+getValueTypeDesc()
                +" from Boolean value; no single-boolean/Boolean-arg constructor/factory method");
    }
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 String value; no single-String constructor/factory method");
    }
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.