Skip to content

Commit

Permalink
Fix failing test in post-master-merge FasterXML#1467
Browse files Browse the repository at this point in the history
  • Loading branch information
JooHyukKim committed Nov 23, 2024
1 parent 5b0d3f2 commit 14d9439
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ protected BeanDeserializer(BeanDeserializer src, boolean ignoreAllUnknown) {
}

protected BeanDeserializer(BeanDeserializer src,
UnwrappedPropertyHandler unwrapHandler, BeanPropertyMap renamedProperties,
boolean ignoreAllUnknown) {
super(src, unwrapHandler, renamedProperties, ignoreAllUnknown);
UnwrappedPropertyHandler unwrapHandler, PropertyBasedCreator propertyBasedCreator,
BeanPropertyMap renamedProperties, boolean ignoreAllUnknown) {
super(src, unwrapHandler, propertyBasedCreator, renamedProperties, ignoreAllUnknown);
_propNameMatcher = _beanProperties.getNameMatcher();
_propsByIndex = _beanProperties.getNameMatcherProperties();
}
Expand Down Expand Up @@ -131,8 +131,12 @@ public ValueDeserializer<Object> unwrappingDeserializer(DeserializationContext c
if (uwHandler != null) { // delegate further unwraps, if any
uwHandler = uwHandler.renameAll(ctxt, transformer);
}
PropertyBasedCreator pbCreator = _propertyBasedCreator;
if (pbCreator != null) {
pbCreator = pbCreator.renameAll(ctxt, transformer);
}
// and handle direct unwrapping as well:
return new BeanDeserializer(this, uwHandler,
return new BeanDeserializer(this, uwHandler, pbCreator,
_beanProperties.renameAll(ctxt, transformer), true);
} finally { _currentlyTransforming = null; }
}
Expand Down Expand Up @@ -446,7 +450,7 @@ private final Object _vanillaDeserializeWithUnknown(JsonParser p,
return bean;
}
if (ix != PropertyNameMatcher.MATCH_UNKNOWN_NAME) {
return _handleUnexpectedWithin(p, ctxt, bean);
return bean;
}
p.nextToken();
handleUnknownVanilla(p, ctxt, bean, p.currentName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ protected BeanDeserializerBase(BeanDeserializerBase src, boolean ignoreAllUnknow
* invoked and lookup indices need to be updated.
*/
protected BeanDeserializerBase(BeanDeserializerBase src,
UnwrappedPropertyHandler unwrapHandler, BeanPropertyMap renamedProperties,
boolean ignoreAllUnknown)
UnwrappedPropertyHandler unwrapHandler, PropertyBasedCreator propertyBasedCreator,
BeanPropertyMap renamedProperties, boolean ignoreAllUnknown)
{
super(src._beanType);

Expand All @@ -308,7 +308,6 @@ protected BeanDeserializerBase(BeanDeserializerBase src,
_valueInstantiator = src._valueInstantiator;
_delegateDeserializer = src._delegateDeserializer;
_arrayDelegateDeserializer = src._arrayDelegateDeserializer;
_propertyBasedCreator = src._propertyBasedCreator;

_backRefs = src._backRefs;
_ignorableProps = src._ignorableProps;
Expand All @@ -321,6 +320,7 @@ protected BeanDeserializerBase(BeanDeserializerBase src,
_nonStandardCreation = src._nonStandardCreation;

_unwrappedPropertyHandler = unwrapHandler;
_propertyBasedCreator = propertyBasedCreator;
_beanProperties = renamedProperties;

_needViewProcesing = src._needViewProcesing;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ protected BuilderBasedDeserializer(BuilderBasedDeserializer src, boolean ignoreA
}

protected BuilderBasedDeserializer(BuilderBasedDeserializer src,
UnwrappedPropertyHandler unwrapHandler, BeanPropertyMap renamedProperties,
boolean ignoreAllUnknown) {
super(src, unwrapHandler, renamedProperties, ignoreAllUnknown);
UnwrappedPropertyHandler unwrapHandler, PropertyBasedCreator pbCreator,
BeanPropertyMap renamedProperties, boolean ignoreAllUnknown
) {
super(src, unwrapHandler, pbCreator, renamedProperties, ignoreAllUnknown);
_buildMethod = src._buildMethod;
_targetType = src._targetType;
_propertyNameMatcher = _beanProperties.getNameMatcher();
Expand Down Expand Up @@ -167,9 +168,13 @@ public ValueDeserializer<Object> unwrappingDeserializer(DeserializationContext c
if (uwHandler != null) {
uwHandler = uwHandler.renameAll(ctxt, transformer);
}
PropertyBasedCreator pbCreator = _propertyBasedCreator;
if (pbCreator != null) {
pbCreator = pbCreator.renameAll(ctxt, transformer);
}
// and handle direct unwrapping as well:
BeanPropertyMap props = _beanProperties.renameAll(ctxt, transformer);
return new BuilderBasedDeserializer(this, uwHandler, props, true);
return new BuilderBasedDeserializer(this, uwHandler, pbCreator, props, true);
} finally { _currentlyTransforming = null; }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import tools.jackson.databind.deser.SettableBeanProperty;
import tools.jackson.databind.deser.bean.BeanDeserializer;
import tools.jackson.databind.deser.bean.BeanPropertyMap;
import tools.jackson.databind.deser.bean.PropertyBasedCreator;
import tools.jackson.databind.deser.impl.UnwrappedPropertyHandler;
import tools.jackson.databind.util.NameTransformer;

Expand Down Expand Up @@ -53,9 +54,10 @@ public static ThrowableDeserializer construct(DeserializationContext ctxt,
* Alternative constructor used when creating "unwrapping" deserializers
*/
protected ThrowableDeserializer(BeanDeserializer src,
UnwrappedPropertyHandler unwrapHandler, BeanPropertyMap renamedProperties,
UnwrappedPropertyHandler unwrapHandler, PropertyBasedCreator pbCreator,
BeanPropertyMap renamedProperties,
boolean ignoreAllUnknown) {
super(src, unwrapHandler, renamedProperties, ignoreAllUnknown);
super(src, unwrapHandler, pbCreator, renamedProperties, ignoreAllUnknown);
}

@Override
Expand All @@ -72,8 +74,12 @@ public ValueDeserializer<Object> unwrappingDeserializer(DeserializationContext c
if (uwHandler != null) {
uwHandler = uwHandler.renameAll(ctxt, transformer);
}
PropertyBasedCreator pbCreator = _propertyBasedCreator;
if (pbCreator != null) {
pbCreator = pbCreator.renameAll(ctxt, transformer);
}
// and handle direct unwrapping as well:
return new ThrowableDeserializer(this, uwHandler,
return new ThrowableDeserializer(this, uwHandler, pbCreator,
_beanProperties.renameAll(ctxt, transformer), true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ public void testUnwrappedWithJsonCreatorImplicitWithName() throws Exception
assertEquals("value2", outer.getInner().getProperty2());
}

// [databind#1467]: works for 2.19+, fails for 3.0 for some reason
@JacksonTestFailureExpected
@Test
public void testUnwrappedWithTwoUnwrappedProperties() throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import static org.junit.jupiter.api.Assertions.*;

// [databind#1467]: works for 2.19+, fails for 3.0 for some reason
public class UnwrappedWithPrefixCreator1467Test extends DatabindTestUtil
{
static class Outer {
Expand All @@ -32,7 +31,6 @@ public String getProperty() {

private final ObjectMapper MAPPER = newJsonMapper();

@JacksonTestFailureExpected
@Test
public void testUnwrappedWithJsonCreatorWithExplicitWithoutName() throws Exception
{
Expand Down

0 comments on commit 14d9439

Please sign in to comment.