@@ -385,7 +385,7 @@ protected Object _deserializeUsingPropertyBased(final JsonParser p, final Deseri
385
385
try {
386
386
bean = creator .build (ctxt , buffer );
387
387
} catch (Exception e ) {
388
- wrapAndThrow ( e , _beanType . getRawClass (), propName , ctxt );
388
+ wrapInstantiationProblem ( e , ctxt );
389
389
bean = null ; // never gets here
390
390
}
391
391
if (bean == null ) {
@@ -413,7 +413,8 @@ protected Object _deserializeUsingPropertyBased(final JsonParser p, final Deseri
413
413
// regular property? needs buffering
414
414
SettableBeanProperty prop = _beanProperties .find (propName );
415
415
if (prop != null ) {
416
- buffer .bufferProperty (prop , prop .deserialize (p , ctxt ));
416
+ buffer .bufferProperty (prop ,
417
+ deserializeWithErrorWrapping (prop , p , ctxt , propName ));
417
418
continue ;
418
419
}
419
420
// As per [JACKSON-313], things marked as ignorable should not be
@@ -424,7 +425,11 @@ protected Object _deserializeUsingPropertyBased(final JsonParser p, final Deseri
424
425
}
425
426
// "any property"?
426
427
if (_anySetter != null ) {
427
- buffer .bufferAnyProperty (_anySetter , propName , _anySetter .deserialize (p , ctxt ));
428
+ try {
429
+ buffer .bufferAnyProperty (_anySetter , propName , _anySetter .deserialize (p , ctxt ));
430
+ } catch (Exception e ) {
431
+ wrapAndThrow (e , _beanType .getRawClass (), propName , ctxt );
432
+ }
428
433
continue ;
429
434
}
430
435
// Ok then, let's collect the whole field; name and value
@@ -454,11 +459,11 @@ protected Object _deserializeUsingPropertyBased(final JsonParser p, final Deseri
454
459
return bean ;
455
460
}
456
461
457
- protected Object deserializeWithErrorWrapping (SettableBeanProperty creatorProp , JsonParser p , DeserializationContext ctxt ,
458
- String propName )
459
- throws IOException {
462
+ protected Object deserializeWithErrorWrapping (SettableBeanProperty prop ,
463
+ JsonParser p , DeserializationContext ctxt , String propName ) throws IOException
464
+ {
460
465
try {
461
- return creatorProp .deserialize (p , ctxt );
466
+ return prop .deserialize (p , ctxt );
462
467
} catch (IOException e ) {
463
468
wrapAndThrow (e , _beanType .getRawClass (), propName , ctxt );
464
469
// exception below will be throw only if someone overwrite default implementation of wrapAndThrow method
@@ -639,7 +644,7 @@ protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p, Deseri
639
644
try {
640
645
bean = creator .build (ctxt , buffer );
641
646
} catch (Exception e ) {
642
- wrapAndThrow ( e , _beanType . getRawClass (), propName , ctxt );
647
+ wrapInstantiationProblem ( e , ctxt );
643
648
continue ; // never gets here
644
649
}
645
650
// [databind#631]: Assign current value, to be accessible by custom serializers
@@ -668,9 +673,11 @@ protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p, Deseri
668
673
// regular property? needs buffering
669
674
SettableBeanProperty prop = _beanProperties .find (propName );
670
675
if (prop != null ) {
671
- buffer .bufferProperty (prop , prop .deserialize (p , ctxt ));
676
+ buffer .bufferProperty (prop ,
677
+ deserializeWithErrorWrapping (prop , p , ctxt , propName ));
672
678
continue ;
673
679
}
680
+
674
681
/* As per [JACKSON-313], things marked as ignorable should not be
675
682
* passed to any setter
676
683
*/
@@ -682,14 +689,18 @@ protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p, Deseri
682
689
tokens .copyCurrentStructure (p );
683
690
// "any property"?
684
691
if (_anySetter != null ) {
685
- buffer .bufferAnyProperty (_anySetter , propName , _anySetter .deserialize (p , ctxt ));
692
+ try {
693
+ buffer .bufferAnyProperty (_anySetter , propName , _anySetter .deserialize (p , ctxt ));
694
+ } catch (Exception e ) {
695
+ wrapAndThrow (e , _beanType .getRawClass (), propName , ctxt );
696
+ }
686
697
}
687
698
}
688
699
689
700
// We hit END_OBJECT, so:
690
701
Object bean ;
691
702
try {
692
- bean = creator .build (ctxt , buffer );
703
+ bean = creator .build (ctxt , buffer );
693
704
} catch (Exception e ) {
694
705
wrapInstantiationProblem (e , ctxt );
695
706
return null ; // never gets here
0 commit comments