diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerBuilder.java b/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerBuilder.java index 8185d6a287..054df61665 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerBuilder.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerBuilder.java @@ -20,26 +20,22 @@ public class BeanDeserializerBuilder { /* /********************************************************** - /* General information about POJO + /* Configuration /********************************************************** */ - /** - * Introspected information about POJO for deserializer to handle - */ - final protected BeanDescription _beanDesc; + final protected DeserializationConfig _config; - /** - * Whether default setting for properties without any view annotations - * is to include (true) or exclude (false). + /* + /********************************************************** + /* General information about POJO + /********************************************************** */ - final protected boolean _defaultViewInclusion; /** - * Flag that indicates whether default settings suggest use of case-insensitive - * property comparison or not. + * Introspected information about POJO for deserializer to handle */ - final protected boolean _caseInsensitivePropertyComparison; + final protected BeanDescription _beanDesc; /* /********************************************************** @@ -114,8 +110,7 @@ public BeanDeserializerBuilder(BeanDescription beanDesc, DeserializationConfig config) { _beanDesc = beanDesc; - _defaultViewInclusion = config.isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION); - _caseInsensitivePropertyComparison = config.isEnabled(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES); + _config = config; } /** @@ -125,8 +120,7 @@ public BeanDeserializerBuilder(BeanDescription beanDesc, protected BeanDeserializerBuilder(BeanDeserializerBuilder src) { _beanDesc = src._beanDesc; - _defaultViewInclusion = src._defaultViewInclusion; - _caseInsensitivePropertyComparison = src._caseInsensitivePropertyComparison; + _config = src._config; // let's make copy of properties _properties.putAll(src._properties); @@ -205,6 +199,11 @@ public void addInjectable(PropertyName propName, JavaType propType, if (_injectables == null) { _injectables = new ArrayList(); } + boolean fixAccess = _config.canOverrideAccessModifiers(); + boolean forceAccess = fixAccess && _config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS); + if (fixAccess) { + member.fixAccess(forceAccess); + } _injectables.add(new ValueInjector(propName, propType, contextAnnotations, member, valueId)); } @@ -314,7 +313,7 @@ public AnnotatedMethod getBuildMethod() { public JsonPOJOBuilder.Value getBuilderConfig() { return _builderConfig; } - + /* /********************************************************** /* Build method(s) @@ -328,14 +327,16 @@ public JsonPOJOBuilder.Value getBuilderConfig() { public JsonDeserializer build() { Collection props = _properties.values(); - BeanPropertyMap propertyMap = BeanPropertyMap.construct(props, _caseInsensitivePropertyComparison); + _fixAccess(props); + + BeanPropertyMap propertyMap = BeanPropertyMap.construct(props, + _config.isEnabled(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES)); propertyMap.assignIndexes(); // view processing must be enabled if: // (a) fields are not included by default (when deserializing with view), OR // (b) one of properties has view(s) to included in defined - boolean anyViews = !_defaultViewInclusion; - + boolean anyViews = !_config.isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION); if (!anyViews) { for (SettableBeanProperty prop : props) { if (prop.hasViews()) { @@ -382,8 +383,10 @@ public JsonDeserializer buildBuilderBased(JavaType valueType, if (_buildMethod == null) { // as per [databind#777], allow empty name if (!expBuildMethodName.isEmpty()) { - throw new IllegalArgumentException("Builder class "+_beanDesc.getBeanClass().getName() - +" does not have build method (name: '"+expBuildMethodName+"')"); + throw new IllegalArgumentException(String.format( + "Builder class %s does not have build method (name: '%s')", + _beanDesc.getBeanClass().getName(), + expBuildMethodName)); } } else { // also: type of the method must be compatible @@ -399,10 +402,12 @@ public JsonDeserializer buildBuilderBased(JavaType valueType, } // And if so, we can try building the deserializer Collection props = _properties.values(); - BeanPropertyMap propertyMap = BeanPropertyMap.construct(props, _caseInsensitivePropertyComparison); + _fixAccess(props); + BeanPropertyMap propertyMap = BeanPropertyMap.construct(props, + _config.isEnabled(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES)); propertyMap.assignIndexes(); - boolean anyViews = !_defaultViewInclusion; + boolean anyViews = !_config.isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION); if (!anyViews) { for (SettableBeanProperty prop : props) { @@ -427,4 +432,46 @@ public JsonDeserializer buildBuilderBased(JavaType valueType, _beanDesc, propertyMap, _backRefProperties, _ignorableProps, _ignoreAllUnknown, anyViews); } + + /* + /********************************************************** + /* Internal helper method(s) + /********************************************************** + */ + + private void _fixAccess(Collection mainProps) + { + /* 07-Sep-2016, tatu: Ideally we should be able to avoid forcing + * access to properties that are likely ignored, but due to + * renaming it seems this is not a safe thing to do (there was + * at least one failing test). May need to dig deeper in future; + * for now let's just play it safe. + */ + /* + Set ignorable = _ignorableProps; + if (ignorable == null) { + ignorable = Collections.emptySet(); + } + */ + for (SettableBeanProperty prop : mainProps) { + /* + // first: no point forcing access on to-be-ignored properties + if (ignorable.contains(prop.getName())) { + continue; + } + */ + prop.fixAccess(_config); + } + if (_backRefProperties != null) { + for (SettableBeanProperty prop : _backRefProperties.values()) { + prop.fixAccess(_config); + } + } + if (_anySetter != null) { + _anySetter.fixAccess(_config); + } + if (_buildMethod != null) { + _buildMethod.fixAccess(_config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); + } + } } diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerFactory.java b/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerFactory.java index 813c8d9589..46aabfed88 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerFactory.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerFactory.java @@ -231,7 +231,6 @@ public JsonDeserializer buildBeanDeserializer(DeserializationContext ctx addInjectables(ctxt, beanDesc, builder); final DeserializationConfig config = ctxt.getConfig(); - // [JACKSON-440]: update builder now that all information is in? if (_factoryConfig.hasDeserializerModifiers()) { for (BeanDeserializerModifier mod : _factoryConfig.deserializerModifiers()) { builder = mod.updateBuilder(config, beanDesc, builder); @@ -640,8 +639,8 @@ protected void addReferenceProperties(DeserializationContext ctxt, } SimpleBeanPropertyDefinition propDef = SimpleBeanPropertyDefinition.construct( ctxt.getConfig(), m); - builder.addBackReferenceProperty(name, constructSettableProperty( - ctxt, beanDesc, propDef, type)); + builder.addBackReferenceProperty(name, constructSettableProperty(ctxt, + beanDesc, propDef, type)); } } } @@ -656,13 +655,8 @@ protected void addInjectables(DeserializationContext ctxt, { Map raw = beanDesc.findInjectables(); if (raw != null) { - boolean fixAccess = ctxt.canOverrideAccessModifiers(); - boolean forceAccess = fixAccess && ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS); for (Map.Entry entry : raw.entrySet()) { AnnotatedMember m = entry.getValue(); - if (fixAccess) { - m.fixAccess(forceAccess); // to ensure we can call it - } builder.addInjectable(PropertyName.construct(m.getName()), m.getType(), beanDesc.getClassAnnotations(), m, entry.getKey()); @@ -683,10 +677,6 @@ protected SettableAnyProperty constructAnySetter(DeserializationContext ctxt, BeanDescription beanDesc, AnnotatedMember mutator) throws JsonMappingException { - if (ctxt.canOverrideAccessModifiers()) { - mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); // to ensure we can call it - } - //find the java type based on the annotated setter method or setter field JavaType type = null; if (mutator instanceof AnnotatedMethod) { @@ -729,19 +719,6 @@ protected SettableBeanProperty constructSettableProperty(DeserializationContext { // need to ensure method is callable (for non-public) AnnotatedMember mutator = propDef.getNonConstructorMutator(); - - if (ctxt.canOverrideAccessModifiers()) { - // [databind#877]: explicitly prevent forced access to `cause` of `Throwable`; - // never needed and attempts may cause problems on some platforms. - // !!! NOTE: should be handled better for 2.8 and later - if ((mutator instanceof AnnotatedField) - && "cause".equals(mutator.getName()) - && Throwable.class.isAssignableFrom(propType0.getRawClass())) { - ; - } else { - mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); - } - } JavaType type = resolveMemberAndTypeAnnotations(ctxt, mutator, propType0); // Does the Method specify the deserializer to use? If so, let's use it. TypeDeserializer typeDeser = type.getTypeHandler(); @@ -782,10 +759,6 @@ protected SettableBeanProperty constructSetterlessProperty(DeserializationContex throws JsonMappingException { final AnnotatedMethod getter = propDef.getGetter(); - // need to ensure it is callable now: - if (ctxt.canOverrideAccessModifiers()) { - getter.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); - } JavaType type = resolveMemberAndTypeAnnotations(ctxt, getter, getter.getType()); TypeDeserializer typeDeser = type.getTypeHandler(); SettableBeanProperty prop = new SetterlessProperty(propDef, type, typeDeser, diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/CreatorProperty.java b/src/main/java/com/fasterxml/jackson/databind/deser/CreatorProperty.java index 6a9ee45f7b..a64ebefabb 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/CreatorProperty.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/CreatorProperty.java @@ -4,7 +4,7 @@ import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; + import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; import com.fasterxml.jackson.databind.introspect.AnnotatedParameter; @@ -114,6 +114,13 @@ public CreatorProperty withValueDeserializer(JsonDeserializer deser) { return new CreatorProperty(this, deser); } + @Override + public void fixAccess(DeserializationConfig config) { + if (_fallbackSetter != null) { + _fallbackSetter.fixAccess(config); + } + } + /** * NOTE: one exception to immutability, due to problems with CreatorProperty instances * being shared between Bean, separate PropertyBasedCreator @@ -173,19 +180,17 @@ public A getAnnotation(Class acls) { */ @Override - public void deserializeAndSet(JsonParser jp, DeserializationContext ctxt, - Object instance) - throws IOException, JsonProcessingException + public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, + Object instance) throws IOException { - set(instance, deserialize(jp, ctxt)); + set(instance, deserialize(p, ctxt)); } @Override - public Object deserializeSetAndReturn(JsonParser jp, - DeserializationContext ctxt, Object instance) - throws IOException, JsonProcessingException + public Object deserializeSetAndReturn(JsonParser p, + DeserializationContext ctxt, Object instance) throws IOException { - return setAndReturn(instance, deserialize(jp, ctxt)); + return setAndReturn(instance, deserialize(p, ctxt)); } @Override diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/SettableAnyProperty.java b/src/main/java/com/fasterxml/jackson/databind/deser/SettableAnyProperty.java index bdefde075b..8ee86d4330 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/SettableAnyProperty.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/SettableAnyProperty.java @@ -59,11 +59,6 @@ public SettableAnyProperty(BeanProperty property, AnnotatedMember setter, JavaTy _valueTypeDeserializer = typeDeser; _setterIsField = setter instanceof AnnotatedField; } - - public SettableAnyProperty withValueDeserializer(JsonDeserializer deser) { - return new SettableAnyProperty(_property, _setter, _type, - deser, _valueTypeDeserializer); - } /** * Constructor used for JDK Serialization when reading persisted object @@ -78,6 +73,16 @@ protected SettableAnyProperty(SettableAnyProperty src) _setterIsField = src._setterIsField; } + public SettableAnyProperty withValueDeserializer(JsonDeserializer deser) { + return new SettableAnyProperty(_property, _setter, _type, + deser, _valueTypeDeserializer); + } + + public void fixAccess(DeserializationConfig config) { + _setter.fixAccess( + config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); + } + /* /********************************************************** /* JDK serialization handling diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/SettableBeanProperty.java b/src/main/java/com/fasterxml/jackson/databind/deser/SettableBeanProperty.java index 991026b460..7615c6cd84 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/SettableBeanProperty.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/SettableBeanProperty.java @@ -4,12 +4,10 @@ import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.*; + import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.impl.FailingDeserializer; -import com.fasterxml.jackson.databind.introspect.AnnotatedMember; -import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition; -import com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase; -import com.fasterxml.jackson.databind.introspect.ObjectIdInfo; +import com.fasterxml.jackson.databind.introspect.*; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor; import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; import com.fasterxml.jackson.databind.util.Annotations; @@ -309,7 +307,18 @@ public void assignIndex(int index) { } _propertyIndex = index; } - + + /** + * Method called to ensure that the mutator has proper access rights to + * be called, as per configuration. Overridden by implementations that + * have mutators that require access, fields and setters. + * + * @since 2.8.3 + */ + public void fixAccess(DeserializationConfig config) { + ; + } + /* /********************************************************** /* BeanProperty impl diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/impl/FieldProperty.java b/src/main/java/com/fasterxml/jackson/databind/deser/impl/FieldProperty.java index 15fca54c58..4332de563e 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/impl/FieldProperty.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/impl/FieldProperty.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition; import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; import com.fasterxml.jackson.databind.util.Annotations; +import com.fasterxml.jackson.databind.util.ClassUtil; /** * This concrete sub-class implements property that is set @@ -74,7 +75,13 @@ public FieldProperty withName(PropertyName newName) { public FieldProperty withValueDeserializer(JsonDeserializer deser) { return new FieldProperty(this, deser); } - + + @Override + public void fixAccess(DeserializationConfig config) { + ClassUtil.checkAndFixAccess(_field, + config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); + } + /* /********************************************************** /* BeanProperty impl diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/impl/InnerClassProperty.java b/src/main/java/com/fasterxml/jackson/databind/deser/impl/InnerClassProperty.java index 311802e604..1fa76fef05 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/impl/InnerClassProperty.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/impl/InnerClassProperty.java @@ -84,6 +84,11 @@ public InnerClassProperty withValueDeserializer(JsonDeserializer deser) { return new InnerClassProperty(this, deser); } + @Override + public void fixAccess(DeserializationConfig config) { + _delegate.fixAccess(config); + } + // // // BeanProperty impl @Override diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/impl/ManagedReferenceProperty.java b/src/main/java/com/fasterxml/jackson/databind/deser/impl/ManagedReferenceProperty.java index 028cc09182..638c3d52f3 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/impl/ManagedReferenceProperty.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/impl/ManagedReferenceProperty.java @@ -6,10 +6,7 @@ import java.util.Map; import com.fasterxml.jackson.core.JsonParser; - -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonDeserializer; -import com.fasterxml.jackson.databind.PropertyName; +import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.SettableBeanProperty; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; import com.fasterxml.jackson.databind.util.Annotations; @@ -74,7 +71,13 @@ public ManagedReferenceProperty withName(PropertyName newName) { public ManagedReferenceProperty withValueDeserializer(JsonDeserializer deser) { return new ManagedReferenceProperty(this, deser); } - + + @Override + public void fixAccess(DeserializationConfig config) { + _managedProperty.fixAccess(config); + _backProperty.fixAccess(config); + } + /* /********************************************************** /* BeanProperty impl diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/impl/MethodProperty.java b/src/main/java/com/fasterxml/jackson/databind/deser/impl/MethodProperty.java index 86d8f9a590..e034a387db 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/impl/MethodProperty.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/impl/MethodProperty.java @@ -68,7 +68,13 @@ public MethodProperty withName(PropertyName newName) { public MethodProperty withValueDeserializer(JsonDeserializer deser) { return new MethodProperty(this, deser); } - + + @Override + public void fixAccess(DeserializationConfig config) { + _annotated.fixAccess( + config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); + } + /* /********************************************************** /* BeanProperty impl diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/impl/ObjectIdReferenceProperty.java b/src/main/java/com/fasterxml/jackson/databind/deser/impl/ObjectIdReferenceProperty.java index c77d756f22..c7793d39ac 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/impl/ObjectIdReferenceProperty.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/impl/ObjectIdReferenceProperty.java @@ -48,6 +48,13 @@ public SettableBeanProperty withName(PropertyName newName) { return new ObjectIdReferenceProperty(this, newName); } + @Override + public void fixAccess(DeserializationConfig config) { + if (_forward != null) { + _forward.fixAccess(config); + } + } + @Override public A getAnnotation(Class acls) { return _forward.getAnnotation(acls); diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/impl/SetterlessProperty.java b/src/main/java/com/fasterxml/jackson/databind/deser/impl/SetterlessProperty.java index 10c95d3dd7..1d7e5ba52c 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/impl/SetterlessProperty.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/impl/SetterlessProperty.java @@ -61,7 +61,13 @@ public SetterlessProperty withName(PropertyName newName) { public SetterlessProperty withValueDeserializer(JsonDeserializer deser) { return new SetterlessProperty(this, deser); } - + + @Override + public void fixAccess(DeserializationConfig config) { + _annotated.fixAccess( + config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); + } + /* /********************************************************** /* BeanProperty impl diff --git a/src/test/java/com/fasterxml/jackson/databind/creators/TestValueUpdate.java b/src/test/java/com/fasterxml/jackson/databind/creators/TestValueUpdate.java index 3c7feaea03..228e59747e 100644 --- a/src/test/java/com/fasterxml/jackson/databind/creators/TestValueUpdate.java +++ b/src/test/java/com/fasterxml/jackson/databind/creators/TestValueUpdate.java @@ -36,7 +36,7 @@ void setB(String b) { } } - // [Issue#318] (and Scala module issue #83] + // [databind#318] (and Scala module issue #83] public void testValueUpdateWithCreator() throws Exception { Bean bean = new Bean("abc", "def"); @@ -44,5 +44,4 @@ public void testValueUpdateWithCreator() throws Exception assertEquals("ghi", bean.getA()); assertEquals("jkl", bean.getB()); } - } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/TestAnnotationIgnore.java b/src/test/java/com/fasterxml/jackson/databind/deser/TestAnnotationIgnore.java index b254a4f314..74c656cf12 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/TestAnnotationIgnore.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/TestAnnotationIgnore.java @@ -47,8 +47,7 @@ final static class NoYOrZ public void testSimpleIgnore() throws Exception { - SizeClassIgnore result = MAPPER.readValue - ("{ \"x\":1, \"y\" : 2 }", + SizeClassIgnore result = MAPPER.readValue("{ \"x\":1, \"y\" : 2 }", SizeClassIgnore.class); // x should be set, y not assertEquals(1, result._x); diff --git a/src/test/java/com/fasterxml/jackson/databind/misc/AccessFixTest.java b/src/test/java/com/fasterxml/jackson/databind/misc/AccessFixTest.java index 6e7eb98865..64c4ca5f01 100644 --- a/src/test/java/com/fasterxml/jackson/databind/misc/AccessFixTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/misc/AccessFixTest.java @@ -14,7 +14,7 @@ static class CauseBlockingSecurityManager @Override public void checkPermission(Permission perm) throws SecurityException { if ("suppressAccessChecks".equals(perm.getName())) { -throw new SecurityException("Can not force permission: "+perm); + throw new SecurityException("Can not force permission: "+perm); } } } @@ -24,18 +24,18 @@ public void checkPermission(Permission perm) throws SecurityException { public void testCauseOfThrowableIgnoral() throws Exception { final SecurityManager origSecMan = System.getSecurityManager(); + ObjectMapper mapper = new ObjectMapper(); + mapper.disable(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS); try { System.setSecurityManager(new CauseBlockingSecurityManager()); - _testCauseOfThrowableIgnoral(); + _testCauseOfThrowableIgnoral(mapper); } finally { System.setSecurityManager(origSecMan); } } - private void _testCauseOfThrowableIgnoral() throws Exception + private void _testCauseOfThrowableIgnoral(ObjectMapper mapper) throws Exception { - ObjectMapper mapper = new ObjectMapper(); - mapper.disable(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS); IOException e = mapper.readValue("{}", IOException.class); assertNotNull(e); }