Skip to content

Commit ae75527

Browse files
committed
Fix minor temporary regression wrt ThrowableDeserializer
1 parent 20a1b6b commit ae75527

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerBuilder.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,18 @@ public class BeanDeserializerBuilder
4747
/* Accumulated information about properties
4848
/**********************************************************
4949
*/
50-
50+
5151
/**
5252
* Properties to deserialize collected so far.
5353
*/
5454
final protected Map<String, SettableBeanProperty> _properties
5555
= new LinkedHashMap<String, SettableBeanProperty>();
56-
56+
5757
/**
5858
* Value injectors for deserialization
5959
*/
6060
protected List<ValueInjector> _injectables;
61-
61+
6262
/**
6363
* Back-reference properties this bean contains (if any)
6464
*/
@@ -69,7 +69,7 @@ public class BeanDeserializerBuilder
6969
* purposes (meaning no exception is thrown, value is just skipped).
7070
*/
7171
protected HashSet<String> _ignorableProps;
72-
72+
7373
/**
7474
* Object that will handle value instantiation for the bean type.
7575
*/
@@ -80,7 +80,7 @@ public class BeanDeserializerBuilder
8080
* bean type.
8181
*/
8282
protected ObjectIdReader _objectIdReader;
83-
83+
8484
/**
8585
* Fallback setter used for handling any properties that are not
8686
* mapped to regular setters. If setter is not null, it will be
@@ -110,7 +110,7 @@ public class BeanDeserializerBuilder
110110
/* Life-cycle: construction
111111
/**********************************************************
112112
*/
113-
113+
114114
public BeanDeserializerBuilder(BeanDescription beanDesc,
115115
DeserializationContext ctxt)
116116
{
@@ -137,10 +137,10 @@ protected BeanDeserializerBuilder(BeanDeserializerBuilder src)
137137
_ignorableProps = src._ignorableProps;
138138
_valueInstantiator = src._valueInstantiator;
139139
_objectIdReader = src._objectIdReader;
140-
140+
141141
_anySetter = src._anySetter;
142142
_ignoreAllUnknown = src._ignoreAllUnknown;
143-
143+
144144
_buildMethod = src._buildMethod;
145145
_builderConfig = src._builderConfig;
146146
}

src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerFactory.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -371,20 +371,16 @@ public JsonDeserializer<Object> buildThrowableDeserializer(DeserializationContex
371371
// (and assume there won't be any back references)
372372

373373
// But then let's decorate things a bit
374-
/* To resolve [JACKSON-95], need to add "initCause" as setter
375-
* for exceptions (sub-classes of Throwable).
376-
*/
374+
// Need to add "initCause" as setter for exceptions (sub-classes of Throwable).
377375
AnnotatedMethod am = beanDesc.findMethod("initCause", INIT_CAUSE_PARAMS);
378376
if (am != null) { // should never be null
379377
SimpleBeanPropertyDefinition propDef = SimpleBeanPropertyDefinition.construct(ctxt.getConfig(), am,
380378
new PropertyName("cause"));
381379
SettableBeanProperty prop = constructSettableProperty(ctxt, beanDesc, propDef,
382380
am.getParameterType(0));
383381
if (prop != null) {
384-
/* 21-Aug-2011, tatus: We may actually have found 'cause' property
385-
* to set... but let's replace it just in case,
386-
* otherwise can end up with odd errors.
387-
*/
382+
// 21-Aug-2011, tatus: We may actually have found 'cause' property
383+
// to set... but let's replace it just in case, otherwise can end up with odd errors.
388384
builder.addOrReplaceProperty(prop, true);
389385
}
390386
}
@@ -393,10 +389,10 @@ public JsonDeserializer<Object> buildThrowableDeserializer(DeserializationContex
393389
builder.addIgnorable("localizedMessage");
394390
// Java 7 also added "getSuppressed", skip if we have such data:
395391
builder.addIgnorable("suppressed");
396-
/* As well as "message": it will be passed via constructor,
397-
* as there's no 'setMessage()' method
398-
*/
399-
builder.addIgnorable("message");
392+
// As well as "message": it will be passed via constructor,
393+
// as there's no 'setMessage()' method
394+
// 23-Jan-2018, tatu: ... although there MAY be Creator Property... which is problematic
395+
// builder.addIgnorable("message");
400396

401397
// update builder now that all information is in?
402398
if (_factoryConfig.hasDeserializerModifiers()) {

src/main/java/com/fasterxml/jackson/databind/deser/std/ThrowableDeserializer.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ public Object deserializeFromObject(JsonParser p, DeserializationContext ctxt) t
105105
}
106106

107107
// Maybe it's "message"?
108-
if (PROP_NAME_MESSAGE.equals(propName)) {
108+
final boolean isMessage = PROP_NAME_MESSAGE.equals(propName);
109+
if (isMessage) {
109110
if (hasStringCreator) {
110111
throwable = _valueInstantiator.createFromString(ctxt, p.getValueAsString());
111112
// any pending values?
@@ -128,6 +129,9 @@ public Object deserializeFromObject(JsonParser p, DeserializationContext ctxt) t
128129
_anySetter.deserializeAndSet(p, ctxt, throwable, propName);
129130
continue;
130131
}
132+
// 23-Jan-2018, tatu: One concern would be `message`, but without any-setter or single-String-ctor
133+
// (or explicit constructor). We could just ignore it but for now, let it fail
134+
131135
// Unknown: let's call handler method
132136
handleUnknownProperty(p, ctxt, throwable, propName);
133137
}

0 commit comments

Comments
 (0)