And some more passing of JsonParser for exceptions
diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerBase.java b/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerBase.java
index 318bc64..39fb1e8 100644
--- a/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerBase.java
+++ b/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerBase.java
@@ -998,14 +998,12 @@
*
* @since 2.3
*/
- protected Object _handleTypedObjectId(JsonParser jp, DeserializationContext ctxt,
+ protected Object _handleTypedObjectId(JsonParser p, DeserializationContext ctxt,
Object pojo, Object rawId)
throws IOException
{
- /* 07-Aug-2013, tatu: One more challenge: type of id may not be type
- * of property we are expecting later on; specifically, numeric ids
- * vs Strings.
- */
+ // One more challenge: type of id may not be type of property we are expecting
+ // later on; specifically, numeric ids vs Strings.
JsonDeserializer<Object> idDeser = _objectIdReader.getDeserializer();
final Object id;
@@ -1014,7 +1012,7 @@
// nope: already same type
id = rawId;
} else {
- id = _convertObjectId(jp, ctxt, rawId, idDeser);
+ id = _convertObjectId(p, ctxt, rawId, idDeser);
}
ReadableObjectId roid = ctxt.findObjectId(id, _objectIdReader.generator, _objectIdReader.resolver);
diff --git a/src/main/java/com/fasterxml/jackson/databind/exc/IgnoredPropertyException.java b/src/main/java/com/fasterxml/jackson/databind/exc/IgnoredPropertyException.java
index cd70f53..2e0b0a2 100644
--- a/src/main/java/com/fasterxml/jackson/databind/exc/IgnoredPropertyException.java
+++ b/src/main/java/com/fasterxml/jackson/databind/exc/IgnoredPropertyException.java
@@ -18,6 +18,20 @@
{
private static final long serialVersionUID = 1L;
+ /**
+ * @since 2.7
+ */
+ public IgnoredPropertyException(JsonParser p, String msg, JsonLocation loc,
+ Class<?> referringClass, String propName,
+ Collection<Object> propertyIds)
+ {
+ super(p, msg, loc, referringClass, propName, propertyIds);
+ }
+
+ /**
+ * @deprecated Since 2.7
+ */
+ @Deprecated
public IgnoredPropertyException(String msg, JsonLocation loc,
Class<?> referringClass, String propName,
Collection<Object> propertyIds)
@@ -25,6 +39,7 @@
super(msg, loc, referringClass, propName, propertyIds);
}
+
/**
* Factory method used for constructing instances of this exception type.
*
@@ -35,7 +50,7 @@
* @param propertyIds (optional, null if not available) Set of properties that
* type would recognize, if completely known: null if set can not be determined.
*/
- public static IgnoredPropertyException from(JsonParser jp,
+ public static IgnoredPropertyException from(JsonParser p,
Object fromObjectOrClass, String propertyName,
Collection<Object> propertyIds)
{
@@ -50,8 +65,8 @@
}
String msg = "Ignored field \""+propertyName+"\" (class "+ref.getName()
+") encountered; mapper configured not to allow this";
- IgnoredPropertyException e = new IgnoredPropertyException(msg,
- jp.getCurrentLocation(), ref, propertyName, propertyIds);
+ IgnoredPropertyException e = new IgnoredPropertyException(p, msg,
+ p.getCurrentLocation(), ref, propertyName, propertyIds);
// but let's also ensure path includes this last (missing) segment
e.prependPath(fromObjectOrClass, propertyName);
return e;
diff --git a/src/main/java/com/fasterxml/jackson/databind/exc/PropertyBindingException.java b/src/main/java/com/fasterxml/jackson/databind/exc/PropertyBindingException.java
index 455376c..2dcfe8a 100644
--- a/src/main/java/com/fasterxml/jackson/databind/exc/PropertyBindingException.java
+++ b/src/main/java/com/fasterxml/jackson/databind/exc/PropertyBindingException.java
@@ -5,6 +5,7 @@
import java.util.Iterator;
import com.fasterxml.jackson.core.JsonLocation;
+import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.JsonMappingException;
/**
@@ -28,7 +29,7 @@
* reference path.
*/
protected final String _propertyName;
-
+
/**
* Set of ids of properties that are known for the type, if this
* can be statically determined.
@@ -40,16 +41,29 @@
* constructing actual message if and as needed.
*/
protected transient String _propertiesAsString;
-
+
+ /**
+ * @since 2.7
+ */
+ protected PropertyBindingException(JsonParser p, String msg, JsonLocation loc,
+ Class<?> referringClass, String propName,
+ Collection<Object> propertyIds)
+ {
+ super(p, msg, loc);
+ _referringClass = referringClass;
+ _propertyName = propName;
+ _propertyIds = propertyIds;
+ }
+
+ /**
+ * @deprecated Since 2.7
+ */
+ @Deprecated // since 2.7
protected PropertyBindingException(String msg, JsonLocation loc,
Class<?> referringClass, String propName,
Collection<Object> propertyIds)
{
-
- super(msg, loc);
- _referringClass = referringClass;
- _propertyName = propName;
- _propertyIds = propertyIds;
+ this(null, msg, loc, referringClass, propName, propertyIds);
}
/*
diff --git a/src/main/java/com/fasterxml/jackson/databind/exc/UnrecognizedPropertyException.java b/src/main/java/com/fasterxml/jackson/databind/exc/UnrecognizedPropertyException.java
index d296e75..24e0b3e 100644
--- a/src/main/java/com/fasterxml/jackson/databind/exc/UnrecognizedPropertyException.java
+++ b/src/main/java/com/fasterxml/jackson/databind/exc/UnrecognizedPropertyException.java
@@ -17,6 +17,17 @@
{
private static final long serialVersionUID = 1L;
+ public UnrecognizedPropertyException(JsonParser p, String msg, JsonLocation loc,
+ Class<?> referringClass, String propName,
+ Collection<Object> propertyIds)
+ {
+ super(p, msg, loc, referringClass, propName, propertyIds);
+ }
+
+ /**
+ * @deprecated Since 2.7
+ */
+ @Deprecated // since 2.7
public UnrecognizedPropertyException(String msg, JsonLocation loc,
Class<?> referringClass, String propName,
Collection<Object> propertyIds)
@@ -34,7 +45,7 @@
* @param propertyIds (optional, null if not available) Set of properties that
* type would recognize, if completely known: null if set can not be determined.
*/
- public static UnrecognizedPropertyException from(JsonParser jp,
+ public static UnrecognizedPropertyException from(JsonParser p,
Object fromObjectOrClass, String propertyName,
Collection<Object> propertyIds)
{
@@ -48,18 +59,10 @@
ref = fromObjectOrClass.getClass();
}
String msg = "Unrecognized field \""+propertyName+"\" (class "+ref.getName()+"), not marked as ignorable";
- UnrecognizedPropertyException e = new UnrecognizedPropertyException(msg,
- jp.getCurrentLocation(), ref, propertyName, propertyIds);
+ UnrecognizedPropertyException e = new UnrecognizedPropertyException(p, msg,
+ p.getCurrentLocation(), ref, propertyName, propertyIds);
// but let's also ensure path includes this last (missing) segment
e.prependPath(fromObjectOrClass, propertyName);
return e;
}
-
- /**
- * @deprecated Since 2.3, use {@link #getPropertyName} instead.
- */
- @Deprecated // since 2.3
- public String getUnrecognizedPropertyName() {
- return getPropertyName();
- }
}