Skip to content

Commit 95d7e2e

Browse files
committed
Some followup work wrt #2944
1 parent 4f34dfe commit 95d7e2e

File tree

5 files changed

+36
-36
lines changed

5 files changed

+36
-36
lines changed

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -403,13 +403,12 @@ protected Object _deserializeUsingPropertyBased(final JsonParser p, final Deseri
403403
for (; t == JsonToken.FIELD_NAME; t = p.nextToken()) {
404404
String propName = p.getCurrentName();
405405
p.nextToken(); // to point to value
406-
SettableBeanProperty creatorProp = creator.findCreatorProperty(propName);
406+
final SettableBeanProperty creatorProp = creator.findCreatorProperty(propName);
407407
// Object Id property?
408408
if (buffer.readIdProperty(propName) && creatorProp == null) {
409409
continue;
410410
}
411411
// creator property?
412-
413412
if (creatorProp != null) {
414413
// Last creator property to set?
415414
Object value;
@@ -794,7 +793,11 @@ protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p, Deseri
794793
String propName = p.getCurrentName();
795794
p.nextToken(); // to point to value
796795
// creator property?
797-
SettableBeanProperty creatorProp = creator.findCreatorProperty(propName);
796+
final SettableBeanProperty creatorProp = creator.findCreatorProperty(propName);
797+
// Object Id property?
798+
if (buffer.readIdProperty(propName) && creatorProp == null) {
799+
continue;
800+
}
798801
if (creatorProp != null) {
799802
// Last creator property to set?
800803
if (buffer.assignParameter(creatorProp,
@@ -833,10 +836,6 @@ protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p, Deseri
833836
}
834837
continue;
835838
}
836-
// Object Id property?
837-
if (buffer.readIdProperty(propName)) {
838-
continue;
839-
}
840839
// regular property? needs buffering
841840
SettableBeanProperty prop = _beanProperties.find(propName);
842841
if (prop != null) {
@@ -976,7 +975,11 @@ protected Object deserializeUsingPropertyBasedWithExternalTypeId(JsonParser p, D
976975
String propName = p.getCurrentName();
977976
p.nextToken(); // to point to value
978977
// creator property?
979-
SettableBeanProperty creatorProp = creator.findCreatorProperty(propName);
978+
final SettableBeanProperty creatorProp = creator.findCreatorProperty(propName);
979+
// Object Id property?
980+
if (buffer.readIdProperty(propName) && creatorProp == null) {
981+
continue;
982+
}
980983
if (creatorProp != null) {
981984
// first: let's check to see if this might be part of value with external type id:
982985
// 11-Sep-2015, tatu: Important; do NOT pass buffer as last arg, but null,
@@ -1012,10 +1015,6 @@ protected Object deserializeUsingPropertyBasedWithExternalTypeId(JsonParser p, D
10121015
}
10131016
continue;
10141017
}
1015-
// Object Id property?
1016-
if (buffer.readIdProperty(propName)) {
1017-
continue;
1018-
}
10191018
// regular property? needs buffering
10201019
SettableBeanProperty prop = _beanProperties.find(propName);
10211020
if (prop != null) {

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,11 @@ protected Object _deserializeUsingPropertyBased(final JsonParser p,
355355
String propName = p.getCurrentName();
356356
p.nextToken(); // to point to value
357357
// creator property?
358-
SettableBeanProperty creatorProp = creator.findCreatorProperty(propName);
358+
final SettableBeanProperty creatorProp = creator.findCreatorProperty(propName);
359+
// Object Id property?
360+
if (buffer.readIdProperty(propName) && creatorProp == null) {
361+
continue;
362+
}
359363
if (creatorProp != null) {
360364
if ((activeView != null) && !creatorProp.visibleInView(activeView)) {
361365
p.skipChildren();
@@ -383,10 +387,6 @@ protected Object _deserializeUsingPropertyBased(final JsonParser p,
383387
}
384388
continue;
385389
}
386-
// Object Id property?
387-
if (buffer.readIdProperty(propName)) {
388-
continue;
389-
}
390390
// regular property? needs buffering
391391
SettableBeanProperty prop = _beanProperties.find(propName);
392392
if (prop != null) {
@@ -630,7 +630,11 @@ protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p,
630630
String propName = p.getCurrentName();
631631
p.nextToken(); // to point to value
632632
// creator property?
633-
SettableBeanProperty creatorProp = creator.findCreatorProperty(propName);
633+
final SettableBeanProperty creatorProp = creator.findCreatorProperty(propName);
634+
// Object Id property?
635+
if (buffer.readIdProperty(propName) && creatorProp == null) {
636+
continue;
637+
}
634638
if (creatorProp != null) {
635639
// Last creator property to set?
636640
if (buffer.assignParameter(creatorProp, creatorProp.deserialize(p, ctxt))) {
@@ -648,10 +652,6 @@ protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p,
648652
}
649653
continue;
650654
}
651-
// Object Id property?
652-
if (buffer.readIdProperty(propName)) {
653-
continue;
654-
}
655655
// regular property? needs buffering
656656
SettableBeanProperty prop = _beanProperties.find(propName);
657657
if (prop != null) {

src/main/java/com/fasterxml/jackson/databind/deser/impl/BeanAsArrayBuilderDeserializer.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,11 @@ protected final Object _deserializeUsingPropertyBased(final JsonParser p,
296296
}
297297
final String propName = prop.getName();
298298
// if not yet, maybe we got a creator property?
299-
SettableBeanProperty creatorProp = creator.findCreatorProperty(propName);
299+
final SettableBeanProperty creatorProp = creator.findCreatorProperty(propName);
300+
// Object Id property?
301+
if (buffer.readIdProperty(propName) && creatorProp == null) {
302+
continue;
303+
}
300304
if (creatorProp != null) {
301305
// Last creator property to set?
302306
if (buffer.assignParameter(creatorProp, creatorProp.deserialize(p, ctxt))) {
@@ -319,10 +323,6 @@ protected final Object _deserializeUsingPropertyBased(final JsonParser p,
319323
}
320324
continue;
321325
}
322-
// Object Id property?
323-
if (buffer.readIdProperty(propName)) {
324-
continue;
325-
}
326326
// regular property? needs buffering
327327
buffer.bufferProperty(prop, prop.deserialize(p, ctxt));
328328
}

src/main/java/com/fasterxml/jackson/databind/deser/impl/BeanAsArrayDeserializer.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,11 @@ protected final Object _deserializeUsingPropertyBased(final JsonParser p, final
313313
}
314314
final String propName = prop.getName();
315315
// if not yet, maybe we got a creator property?
316-
SettableBeanProperty creatorProp = creator.findCreatorProperty(propName);
316+
final SettableBeanProperty creatorProp = creator.findCreatorProperty(propName);
317+
// Object Id property?
318+
if (buffer.readIdProperty(propName) && creatorProp == null) {
319+
continue;
320+
}
317321
if (creatorProp != null) {
318322
// Last creator property to set?
319323
if (buffer.assignParameter(creatorProp, creatorProp.deserialize(p, ctxt))) {
@@ -340,10 +344,6 @@ protected final Object _deserializeUsingPropertyBased(final JsonParser p, final
340344
}
341345
continue;
342346
}
343-
// Object Id property?
344-
if (buffer.readIdProperty(propName)) {
345-
continue;
346-
}
347347
// regular property? needs buffering
348348
buffer.bufferProperty(prop, prop.deserialize(p, ctxt));
349349
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,15 @@ protected Object deserializeEnumUsingPropertyBased(final JsonParser p, final Des
179179
String propName = p.getCurrentName();
180180
p.nextToken(); // to point to value
181181

182-
SettableBeanProperty creatorProp = creator.findCreatorProperty(propName);
183-
if (creatorProp != null) {
184-
buffer.assignParameter(creatorProp, _deserializeWithErrorWrapping(p, ctxt, creatorProp));
182+
final SettableBeanProperty creatorProp = creator.findCreatorProperty(propName);
183+
if (buffer.readIdProperty(propName) && creatorProp == null) {
185184
continue;
186185
}
187-
if (buffer.readIdProperty(propName)) {
186+
if (creatorProp != null) {
187+
buffer.assignParameter(creatorProp, _deserializeWithErrorWrapping(p, ctxt, creatorProp));
188188
continue;
189189
}
190+
// 26-Nov-2020, tatu: ... what should we do here tho?
190191
}
191192
return creator.build(ctxt, buffer);
192193
}

0 commit comments

Comments
 (0)