Skip to content

Commit 9787983

Browse files
committed
Fix minor regression wrt patch for #1855
1 parent 29bdca2 commit 9787983

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,6 @@ protected void _validateSubType(DeserializationContext ctxt, JavaType type,
913913
BeanDescription beanDesc)
914914
throws JsonMappingException
915915
{
916-
SubTypeValidator.instance().validateSubType(ctxt, type);
916+
SubTypeValidator.instance().validateSubType(ctxt, type, beanDesc);
917917
}
918918
}

src/main/java/com/fasterxml/jackson/databind/jsontype/impl/SubTypeValidator.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.util.HashSet;
55
import java.util.Set;
66

7+
import com.fasterxml.jackson.databind.BeanDescription;
78
import com.fasterxml.jackson.databind.DeserializationContext;
89
import com.fasterxml.jackson.databind.JavaType;
910
import com.fasterxml.jackson.databind.JsonMappingException;
@@ -64,7 +65,8 @@ protected SubTypeValidator() { }
6465

6566
public static SubTypeValidator instance() { return instance; }
6667

67-
public void validateSubType(DeserializationContext ctxt, JavaType type) throws JsonMappingException
68+
public void validateSubType(DeserializationContext ctxt, JavaType type,
69+
BeanDescription beanDesc) throws JsonMappingException
6870
{
6971
// There are certain nasty classes that could cause problems, mostly
7072
// via default typing -- catch them here.
@@ -92,7 +94,7 @@ public void validateSubType(DeserializationContext ctxt, JavaType type) throws J
9294
return;
9395
} while (false);
9496

95-
throw JsonMappingException.from(ctxt,
96-
String.format("Illegal type (%s) to deserialize: prevented for security reasons", full));
97+
ctxt.reportBadTypeDefinition(beanDesc,
98+
"Illegal type (%s) to deserialize: prevented for security reasons", full);
9799
}
98100
}

0 commit comments

Comments
 (0)