List of usage examples for com.fasterxml.jackson.core JsonLocation getSourceRef
public Object getSourceRef()
From source file:com.addthis.codec.jackson.Jackson.java
public static JsonMappingException maybeImproveLocation(JsonLocation wrapLoc, JsonMappingException cause) { JsonLocation exLoc = cause.getLocation(); if (isRealLocation(wrapLoc) && !isRealLocation(exLoc)) { if (wrapLoc.getSourceRef() instanceof ConfigValue) { ConfigValue locRef = (ConfigValue) wrapLoc.getSourceRef(); List<JsonMappingException.Reference> paths = cause.getPath(); for (JsonMappingException.Reference path : paths) { if (locRef instanceof ConfigObject) { String fieldName = path.getFieldName(); ConfigObject locRefObject = (ConfigObject) locRef; if (locRefObject.containsKey(fieldName)) { locRef = locRefObject.get(fieldName); } else { break; }/*from ww w.jav a 2 s .co m*/ } else if (locRef instanceof ConfigList) { int fieldIndex = path.getIndex(); ConfigList locRefList = (ConfigList) locRef; if ((fieldIndex >= 0) && (locRefList.size() > fieldIndex)) { locRef = locRefList.get(fieldIndex); } else { break; } } else { break; } } if (locRef != wrapLoc.getSourceRef()) { 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; }