@@ -439,20 +439,27 @@ public JsonDeserializer<Object> buildThrowableDeserializer(DeserializationContex
439439 }
440440 AnnotatedMethod am = beanDesc .findMethod ("initCause" , INIT_CAUSE_PARAMS );
441441 if (am != null ) { // should never be null
442- // [databind#3497]: must consider possible PropertyNamingStrategy
443- String name = "cause" ;
444- PropertyNamingStrategy pts = config .getPropertyNamingStrategy ();
445- if (pts != null ) {
446- name = pts .nameForSetterMethod (config , am , "cause" );
447- }
448- SimpleBeanPropertyDefinition propDef = SimpleBeanPropertyDefinition .construct (ctxt .getConfig (), am ,
449- new PropertyName (name ));
450- SettableBeanProperty prop = constructSettableProperty (ctxt , beanDesc , propDef ,
451- am .getParameterType (0 ));
452- if (prop != null ) {
453- // 21-Aug-2011, tatus: We may actually have found 'cause' property
454- // to set... but let's replace it just in case, otherwise can end up with odd errors.
455- builder .addOrReplaceProperty (prop , true );
442+ SettableBeanProperty causeCreatorProp = builder .findProperty (PropertyName .construct ("cause" ));
443+ // [databind#4827] : Consider case where sub-classed `Exception` has `JsonCreator` with `cause` parameter
444+ if (causeCreatorProp instanceof CreatorProperty ) {
445+ // Set fallback-setter as null, so `fixAccess()` does not happen during build
446+ ((CreatorProperty ) causeCreatorProp ).setFallbackSetter (null );
447+ } else {
448+ // [databind#3497]: must consider possible PropertyNamingStrategy
449+ String name = "cause" ;
450+ PropertyNamingStrategy pts = config .getPropertyNamingStrategy ();
451+ if (pts != null ) {
452+ name = pts .nameForSetterMethod (config , am , "cause" );
453+ }
454+ SimpleBeanPropertyDefinition propDef = SimpleBeanPropertyDefinition .construct (ctxt .getConfig (), am ,
455+ new PropertyName (name ));
456+ SettableBeanProperty prop = constructSettableProperty (ctxt , beanDesc , propDef ,
457+ am .getParameterType (0 ));
458+ if (prop != null ) {
459+ // 21-Aug-2011, tatus: We may actually have found 'cause' property
460+ // to set... but let's replace it just in case, otherwise can end up with odd errors.
461+ builder .addOrReplaceProperty (prop , true );
462+ }
456463 }
457464 }
458465 // update builder now that all information is in?
0 commit comments