Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.JsonMappingException$Reference


                                                    + "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


        }
        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) { // Bit tricky, can't do more calls as stack is full; so:
            JsonMappingException mapE = new JsonMappingException("Infinite recursion (StackOverflowError)");
            String name = (i == props.length) ? "[anySetter]" : props[i].getName();
            mapE.prependPath(new JsonMappingException.Reference(bean, name));
            throw mapE;
        }
    }
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

            throw new IllegalStateException("_createRecord should never be called for elements of type MAP");
        }
        try {
            return new GenericData.Record(schema);
        } catch (RuntimeException e) {
            throw new JsonMappingException("Failed to create Record type from "+type, e);
        }
    }
View Full Code Here

            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

        }
    }

    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

TOP

Related Classes of com.fasterxml.jackson.databind.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.