From 46a9900f949aad977251cf3ea67ca563c17bf524 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Wed, 8 Jul 2015 21:03:02 -0700 Subject: [PATCH] Refactoring to use formatting variant of method --- .../deser/BeanDeserializerFactory.java | 4 +-- .../databind/deser/ValueInstantiator.java | 32 ++++++++++--------- .../impl/BeanAsArrayBuilderDeserializer.java | 25 +++++++++------ .../deser/impl/BeanAsArrayDeserializer.java | 21 +++++++----- .../deser/impl/ExternalTypeHandler.java | 12 ++++--- .../databind/deser/impl/NullProvider.java | 5 +-- .../deser/impl/PropertyValueBuffer.java | 12 +++---- .../deser/std/FromStringDeserializer.java | 3 +- .../deser/std/NumberDeserializers.java | 3 +- .../databind/deser/std/StdDeserializer.java | 5 ++- .../deser/std/StdValueInstantiator.java | 19 ++++++----- .../databind/deser/std/UUIDDeserializer.java | 3 +- .../databind/convert/TestUpdateValue.java | 11 +++---- 13 files changed, 87 insertions(+), 68 deletions(-) diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerFactory.java b/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerFactory.java index 0f4d004851..3a799110ba 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerFactory.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerFactory.java @@ -539,8 +539,8 @@ protected void addBeanProps(DeserializationContext ctxt, } } if (cprop == null) { - throw ctxt.mappingException("Could not find creator property with name '" - +name+"' (in class "+beanDesc.getBeanClass().getName()+")"); + throw ctxt.mappingException("Could not find creator property with name '%s' (in class %s)", + name, beanDesc.getBeanClass().getName()); } if (prop != null) { cprop.setFallbackSetter(prop); diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/ValueInstantiator.java b/src/main/java/com/fasterxml/jackson/databind/deser/ValueInstantiator.java index 67f506dd77..98ad7dacef 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/ValueInstantiator.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/ValueInstantiator.java @@ -143,8 +143,8 @@ public boolean canInstantiate() { * null or empty List. */ public Object createUsingDefault(DeserializationContext ctxt) throws IOException { - throw ctxt.mappingException("Can not instantiate value of type " - +getValueTypeDesc()+"; no default creator found"); + throw ctxt.mappingException("Can not instantiate value of type %s; no default creator found", + getValueTypeDesc()); } /** @@ -156,7 +156,8 @@ public Object createUsingDefault(DeserializationContext ctxt) throws IOException * a non-empty List of arguments. */ public Object createFromObjectWith(DeserializationContext ctxt, Object[] args) throws IOException { - throw ctxt.mappingException("Can not instantiate value of type "+getValueTypeDesc()+" with arguments"); + throw ctxt.mappingException("Can not instantiate value of type %s with arguments", + getValueTypeDesc()); } /** @@ -164,9 +165,10 @@ public Object createFromObjectWith(DeserializationContext ctxt, Object[] args) t * an intermediate "delegate" value to pass to createor method */ public Object createUsingDelegate(DeserializationContext ctxt, Object delegate) throws IOException { - throw ctxt.mappingException("Can not instantiate value of type "+getValueTypeDesc()+" using delegate"); + throw ctxt.mappingException("Can not instantiate value of type %s using delegate", + getValueTypeDesc()); } - + /* /********************************************************** /* Instantiation methods for JSON scalar types @@ -179,23 +181,23 @@ public Object createFromString(DeserializationContext ctxt, String value) throws } public Object createFromInt(DeserializationContext ctxt, int value) throws IOException { - throw ctxt.mappingException("Can not instantiate value of type " - +getValueTypeDesc()+" from Integer number ("+value+", int)"); + throw ctxt.mappingException("Can not instantiate value of type %s from Integer number (%s, int)", + getValueTypeDesc(), value); } public Object createFromLong(DeserializationContext ctxt, long value) throws IOException { - throw ctxt.mappingException("Can not instantiate value of type " - +getValueTypeDesc()+" from Integer number ("+value+", long)"); + throw ctxt.mappingException("Can not instantiate value of type %s from Integer number (%s, long)", + getValueTypeDesc(), value); } public Object createFromDouble(DeserializationContext ctxt, double value) throws IOException { - throw ctxt.mappingException("Can not instantiate value of type " - +getValueTypeDesc()+" from Floating-point number ("+value+", double)"); + throw ctxt.mappingException("Can not instantiate value of type %s from Floating-point number (%s, double)", + getValueTypeDesc(), value); } public Object createFromBoolean(DeserializationContext ctxt, boolean value) throws IOException { - throw ctxt.mappingException("Can not instantiate value of type " - +getValueTypeDesc()+" from Boolean value ("+value+")"); + throw ctxt.mappingException("Can not instantiate value of type %s from Boolean value (%s)", + getValueTypeDesc(), value); } /* @@ -274,7 +276,7 @@ protected Object _createFromStringFallbacks(DeserializationContext ctxt, String return null; } } - throw ctxt.mappingException("Can not instantiate value of type "+getValueTypeDesc() - +" from String value ('"+value+"'); no single-String constructor/factory method"); + throw ctxt.mappingException("Can not instantiate value of type %s from String value ('%s'); no single-String constructor/factory method", + getValueTypeDesc(), value); } } diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/impl/BeanAsArrayBuilderDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/impl/BeanAsArrayBuilderDeserializer.java index 3610b26ba4..1ca180bb47 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/impl/BeanAsArrayBuilderDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/impl/BeanAsArrayBuilderDeserializer.java @@ -128,7 +128,8 @@ public Object deserialize(JsonParser p, DeserializationContext ctxt) } // Ok; extra fields? Let's fail, unless ignoring extra props is fine if (!_ignoreAllUnknown) { - throw ctxt.mappingException("Unexpected JSON values; expected at most "+propCount+" properties (in JSON Array)"); + throw ctxt.mappingException("Unexpected JSON values; expected at most %d properties (in JSON Array)", + propCount); } // otherwise, skip until end while (p.nextToken() != JsonToken.END_ARRAY) { @@ -172,7 +173,8 @@ public Object deserialize(JsonParser p, DeserializationContext ctxt, Object buil // Ok; extra fields? Let's fail, unless ignoring extra props is fine if (!_ignoreAllUnknown) { - throw ctxt.mappingException("Unexpected JSON values; expected at most "+propCount+" properties (in JSON Array)"); + throw ctxt.mappingException("Unexpected JSON values; expected at most %d properties (in JSON Array)", + propCount); } // otherwise, skip until end while (p.nextToken() != JsonToken.END_ARRAY) { @@ -239,7 +241,8 @@ protected Object _deserializeNonVanilla(JsonParser p, DeserializationContext ctx } // Ok; extra fields? Let's fail, unless ignoring extra props is fine if (!_ignoreAllUnknown) { - throw ctxt.mappingException("Unexpected JSON values; expected at most "+propCount+" properties (in JSON Array)"); + throw ctxt.mappingException("Unexpected JSON values; expected at most %d properties (in JSON Array)", + propCount); } // otherwise, skip until end while (p.nextToken() != JsonToken.END_ARRAY) { @@ -322,7 +325,8 @@ protected final Object _deserializeUsingPropertyBased(final JsonParser p, * but make explicitly non-supported for now. */ throw ctxt.mappingException("Can not support implicit polymorphic deserialization for POJOs-as-Arrays style: " - +"nominal type "+_beanType.getRawClass().getName()+", actual type "+builder.getClass().getName()); + +"nominal type %s, actual type %s", + _beanType.getRawClass().getName(), builder.getClass().getName()); } } continue; @@ -353,14 +357,15 @@ protected final Object _deserializeUsingPropertyBased(final JsonParser p, /********************************************************** */ - protected Object _deserializeFromNonArray(JsonParser jp, DeserializationContext ctxt) - throws IOException, JsonProcessingException + protected Object _deserializeFromNonArray(JsonParser p, DeserializationContext ctxt) + throws IOException { // Let's start with failure - throw ctxt.mappingException("Can not deserialize a POJO (of type "+_beanType.getRawClass().getName() - +") from non-Array representation (token: "+jp.getCurrentToken() - +"): type/property designed to be serialized as JSON Array"); + throw ctxt.mappingException("Can not deserialize a POJO (of type %s) from non-Array representation (token: %s): " + +"type/property designed to be serialized as JSON Array", + _beanType.getRawClass().getName(), + p.getCurrentToken()); // in future, may allow use of "standard" POJO serialization as well; if so, do: - //return _delegate.deserialize(jp, ctxt); + //return _delegate.deserialize(p, ctxt); } } diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/impl/BeanAsArrayDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/impl/BeanAsArrayDeserializer.java index 7b1c54e0c6..04869bed67 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/impl/BeanAsArrayDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/impl/BeanAsArrayDeserializer.java @@ -122,7 +122,8 @@ public Object deserialize(JsonParser p, DeserializationContext ctxt) } // Ok; extra fields? Let's fail, unless ignoring extra props is fine if (!_ignoreAllUnknown) { - throw ctxt.mappingException("Unexpected JSON values; expected at most "+propCount+" properties (in JSON Array)"); + throw ctxt.mappingException("Unexpected JSON values; expected at most %d properties (in JSON Array)", + propCount); } // otherwise, skip until end while (p.nextToken() != JsonToken.END_ARRAY) { @@ -168,7 +169,8 @@ public Object deserialize(JsonParser p, DeserializationContext ctxt, Object bean // Ok; extra fields? Let's fail, unless ignoring extra props is fine if (!_ignoreAllUnknown) { - throw ctxt.mappingException("Unexpected JSON values; expected at most "+propCount+" properties (in JSON Array)"); + throw ctxt.mappingException("Unexpected JSON values; expected at most %d properties (in JSON Array)", + propCount); } // otherwise, skip until end while (p.nextToken() != JsonToken.END_ARRAY) { @@ -236,7 +238,8 @@ protected Object _deserializeNonVanilla(JsonParser p, DeserializationContext ctx } // Ok; extra fields? Let's fail, unless ignoring extra props is fine if (!_ignoreAllUnknown) { - throw ctxt.mappingException("Unexpected JSON values; expected at most "+propCount+" properties (in JSON Array)"); + throw ctxt.mappingException("Unexpected JSON values; expected at most %d properties (in JSON Array)", + propCount); } // otherwise, skip until end while (p.nextToken() != JsonToken.END_ARRAY) { @@ -320,7 +323,8 @@ protected final Object _deserializeUsingPropertyBased(final JsonParser p, final * but make explicitly non-supported for now. */ throw ctxt.mappingException("Can not support implicit polymorphic deserialization for POJOs-as-Arrays style: " - +"nominal type "+_beanType.getRawClass().getName()+", actual type "+bean.getClass().getName()); + +"nominal type %s, actual type %s", + _beanType.getRawClass().getName(), bean.getClass().getName()); } } continue; @@ -355,10 +359,11 @@ protected Object _deserializeFromNonArray(JsonParser p, DeserializationContext c throws IOException { // Let's start with failure - throw ctxt.mappingException("Can not deserialize a POJO (of type "+_beanType.getRawClass().getName() - +") from non-Array representation (token: "+p.getCurrentToken() - +"): type/property designed to be serialized as JSON Array"); + throw ctxt.mappingException("Can not deserialize a POJO (of type %s) from non-Array representation (token: %s): " + +"type/property designed to be serialized as JSON Array", + _beanType.getRawClass().getName(), + p.getCurrentToken()); // in future, may allow use of "standard" POJO serialization as well; if so, do: - //return _delegate.deserialize(jp, ctxt); + //return _delegate.deserialize(p, ctxt); } } diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/impl/ExternalTypeHandler.java b/src/main/java/com/fasterxml/jackson/databind/deser/impl/ExternalTypeHandler.java index 55eab2ef96..75b930a0af 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/impl/ExternalTypeHandler.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/impl/ExternalTypeHandler.java @@ -150,13 +150,15 @@ public Object complete(JsonParser jp, DeserializationContext ctxt, Object bean) } // 26-Oct-2012, tatu: As per [Issue#94], must allow use of 'defaultImpl' if (!_properties[i].hasDefaultType()) { - throw ctxt.mappingException("Missing external type id property '"+_properties[i].getTypePropertyName()+"'"); + throw ctxt.mappingException("Missing external type id property '%s'", + _properties[i].getTypePropertyName()); } typeId = _properties[i].getDefaultTypeId(); } } else if (_tokens[i] == null) { SettableBeanProperty prop = _properties[i].getProperty(); - throw ctxt.mappingException("Missing property '"+prop.getName()+"' for external type id '"+_properties[i].getTypePropertyName()); + throw ctxt.mappingException("Missing property '%s' for external type id '%s'", + prop.getName(), _properties[i].getTypePropertyName()); } _deserializeAndSet(jp, ctxt, bean, i, typeId); } @@ -184,12 +186,14 @@ public Object complete(JsonParser jp, DeserializationContext ctxt, // but not just one // 26-Oct-2012, tatu: As per [Issue#94], must allow use of 'defaultImpl' if (!_properties[i].hasDefaultType()) { - throw ctxt.mappingException("Missing external type id property '"+_properties[i].getTypePropertyName()+"'"); + throw ctxt.mappingException("Missing external type id property '%s'", + _properties[i].getTypePropertyName()); } typeId = _properties[i].getDefaultTypeId(); } else if (_tokens[i] == null) { SettableBeanProperty prop = _properties[i].getProperty(); - throw ctxt.mappingException("Missing property '"+prop.getName()+"' for external type id '"+_properties[i].getTypePropertyName()); + throw ctxt.mappingException("Missing property '%s' for external type id '%s'", + prop.getName(), _properties[i].getTypePropertyName()); } values[i] = _deserialize(jp, ctxt, i, typeId); } diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/impl/NullProvider.java b/src/main/java/com/fasterxml/jackson/databind/deser/impl/NullProvider.java index b032ba1da7..24ec174d98 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/impl/NullProvider.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/impl/NullProvider.java @@ -30,8 +30,9 @@ public NullProvider(JavaType type, Object nullValue) public Object nullValue(DeserializationContext ctxt) throws JsonProcessingException { if (_isPrimitive && ctxt.isEnabled(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)) { - throw ctxt.mappingException("Can not map JSON null into type "+_rawType.getName() - +" (set DeserializationConfig.DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES to 'false' to allow)"); + throw ctxt.mappingException("Can not map JSON null into type %s" + +" (set DeserializationConfig.DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES to 'false' to allow)", + _rawType.getName()); } return _nullValue; } diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/impl/PropertyValueBuffer.java b/src/main/java/com/fasterxml/jackson/databind/deser/impl/PropertyValueBuffer.java index c0c4637e87..32e100b7e0 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/impl/PropertyValueBuffer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/impl/PropertyValueBuffer.java @@ -138,12 +138,12 @@ protected Object _findMissing(SettableBeanProperty prop) throws JsonMappingExcep } // Second: required? if (prop.isRequired()) { - throw _context.mappingException(String.format("Missing required creator property '%s' (index %d)", - prop.getName(), prop.getCreatorIndex())); + throw _context.mappingException("Missing required creator property '%s' (index %d)", + prop.getName(), prop.getCreatorIndex()); } if (_context.isEnabled(DeserializationFeature.FAIL_ON_MISSING_CREATOR_PROPERTIES)) { - throw _context.mappingException(String.format("Missing creator property '%s' (index %d); DeserializationFeature.FAIL_ON_MISSING_CREATOR_PROPERTIES enabled", - prop.getName(), prop.getCreatorIndex())); + throw _context.mappingException("Missing creator property '%s' (index %d); DeserializationFeature.FAIL_ON_MISSING_CREATOR_PROPERTIES enabled", + prop.getName(), prop.getCreatorIndex()); } // Third: default value JsonDeserializer deser = prop.getValueDeserializer(); @@ -188,8 +188,8 @@ public Object handleIdValue(final DeserializationContext ctxt, Object bean) thro } } else { // TODO: is this an error case? - throw ctxt.mappingException("No _idValue when handleIdValue called, on instance of " - +bean.getClass().getName()); + throw ctxt.mappingException("No _idValue when handleIdValue called, on instance of %s", + bean.getClass().getName()); } } return bean; diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/FromStringDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/FromStringDeserializer.java index a7352dd6bc..6462243d4d 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/FromStringDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/FromStringDeserializer.java @@ -158,7 +158,8 @@ public T deserialize(JsonParser jp, DeserializationContext ctxt) throws IOExcept protected T _deserializeEmbedded(Object ob, DeserializationContext ctxt) throws IOException { // default impl: error out - throw ctxt.mappingException("Don't know how to convert embedded Object of type "+ob.getClass().getName()+" into "+_valueClass.getName()); + throw ctxt.mappingException("Don't know how to convert embedded Object of type %s into %s", + ob.getClass().getName(), _valueClass.getName()); } protected T _deserializeFromEmptyString() throws IOException { diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/NumberDeserializers.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/NumberDeserializers.java index 5f96dd50f6..4d93b232aa 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/NumberDeserializers.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/NumberDeserializers.java @@ -138,10 +138,9 @@ protected PrimitiveOrWrapperDeserializer(Class vc, T nvl) { public final T getNullValue(DeserializationContext ctxt) throws JsonMappingException { if (_primitive && ctxt.isEnabled(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)) { - String msg = String.format( + throw ctxt.mappingException( "Can not map JSON null into type %s (set DeserializationConfig.DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES to 'false' to allow)", handledType().toString()); - throw ctxt.mappingException(msg); } return _nullValue; } diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/StdDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/StdDeserializer.java index ac53c092c7..b04933a513 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/StdDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/StdDeserializer.java @@ -1053,8 +1053,7 @@ protected void handleUnknownProperty(JsonParser jp, DeserializationContext ctxt, protected void _failDoubleToIntCoercion(JsonParser jp, DeserializationContext ctxt, String type) throws IOException { - throw ctxt.mappingException(String.format - ("Can not coerce a floating-point value ('%s') into %s; enable `DeserializationFeature.ACCEPT_FLOAT_AS_INT` to allow", - jp.getValueAsString(), type)); + throw ctxt.mappingException("Can not coerce a floating-point value ('%s') into %s; enable `DeserializationFeature.ACCEPT_FLOAT_AS_INT` to allow", + jp.getValueAsString(), type); } } diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/StdValueInstantiator.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/StdValueInstantiator.java index 439c2561e2..35b1ff31a9 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/StdValueInstantiator.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/StdValueInstantiator.java @@ -301,8 +301,8 @@ public Object createFromInt(DeserializationContext ctxt, int value) throws IOExc } catch (ExceptionInInitializerError e) { throw wrapException(e); } - throw ctxt.mappingException("Can not instantiate value of type "+getValueTypeDesc() - +" from Integral number ("+value+"); no single-int-arg constructor/factory method"); + throw ctxt.mappingException("Can not instantiate value of type %s from Integral number (%s); no single-int-arg constructor/factory method", + getValueTypeDesc(), value); } @Override @@ -317,8 +317,9 @@ public Object createFromLong(DeserializationContext ctxt, long value) throws IOE } catch (ExceptionInInitializerError e) { throw wrapException(e); } - throw ctxt.mappingException("Can not instantiate value of type "+getValueTypeDesc() - +" from Long integral number ("+value+"); no single-long-arg constructor/factory method"); + throw ctxt.mappingException("Can not instantiate value of type %s" + +" from Long integral number (%s); no single-long-arg constructor/factory method", + getValueTypeDesc(), value); } @Override @@ -333,8 +334,9 @@ public Object createFromDouble(DeserializationContext ctxt, double value) throws } catch (ExceptionInInitializerError e) { throw wrapException(e); } - throw ctxt.mappingException("Can not instantiate value of type "+getValueTypeDesc() - +" from Floating-point number ("+value+"); no one-double/Double-arg constructor/factory method"); + throw ctxt.mappingException("Can not instantiate value of type %s" + +" from Floating-point number (%s); no one-double/Double-arg constructor/factory method", + getValueTypeDesc(), value); } @Override @@ -349,8 +351,9 @@ public Object createFromBoolean(DeserializationContext ctxt, boolean value) thro } catch (ExceptionInInitializerError e) { throw wrapException(e); } - throw ctxt.mappingException("Can not instantiate value of type "+getValueTypeDesc() - +" from Boolean value ("+value+"); no single-boolean/Boolean-arg constructor/factory method"); + throw ctxt.mappingException("Can not instantiate value of type %s" + +" from Boolean value (%s); no single-boolean/Boolean-arg constructor/factory method", + getValueTypeDesc(), value); } /* diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/UUIDDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/UUIDDeserializer.java index 8f5fcc0d84..01f969c9ea 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/UUIDDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/UUIDDeserializer.java @@ -107,7 +107,8 @@ static int _badChar(String uuidStr, int index, char c) { private UUID _fromBytes(byte[] bytes, DeserializationContext ctxt) throws IOException { if (bytes.length != 16) { - ctxt.mappingException("Can only construct UUIDs from byte[16]; got "+bytes.length+" bytes"); + ctxt.mappingException("Can only construct UUIDs from byte[16]; got %d bytes", + bytes.length); } return new UUID(_long(bytes, 0), _long(bytes, 8)); } diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/TestUpdateValue.java b/src/test/java/com/fasterxml/jackson/databind/convert/TestUpdateValue.java index 10791c1934..5698edd889 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/TestUpdateValue.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/TestUpdateValue.java @@ -68,13 +68,12 @@ static class DataADeserializer extends StdDeserializer { } @Override - public DataA deserialize(JsonParser jp, DeserializationContext ctxt) - throws JsonProcessingException, IOException { - if (jp.getCurrentToken() != JsonToken.START_OBJECT) { - throw ctxt.mappingException("Wrong current token, expected START_OBJECT, got: " - +jp.getCurrentToken()); + public DataA deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + if (p.getCurrentToken() != JsonToken.START_OBJECT) { + throw ctxt.mappingException("Wrong current token, expected START_OBJECT, got: %s", + p.getCurrentToken()); } - /*JsonNode node =*/ jp.readValueAsTree(); + /*JsonNode node =*/ p.readValueAsTree(); DataA da = new DataA(); da.i = 5;