Skip to content

Commit bb45fb1

Browse files
committed
Fix issues with earlier fix for #1855
1 parent 6743953 commit bb45fb1

File tree

6 files changed

+38
-2
lines changed

6 files changed

+38
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public void validateSubType(DeserializationContext ctxt, JavaType type) throws J
7171
final Class<?> raw = type.getRawClass();
7272
String full = raw.getName();
7373

74+
main_check:
7475
do {
7576
if (_cfgIllegalClassNames.contains(full)) {
7677
break;
@@ -84,8 +85,8 @@ public void validateSubType(DeserializationContext ctxt, JavaType type) throws J
8485
// looking for "AbstractBeanFactoryPointcutAdvisor" but no point to allow any is there?
8586
if ("AbstractPointcutAdvisor".equals(name)
8687
// ditto for "FileSystemXmlApplicationContext": block all ApplicationContexts
87-
|| "AbstractApplicationContext.equals".equals(name)) {
88-
break;
88+
|| "AbstractApplicationContext".equals(name)) {
89+
break main_check;
8990
}
9091
}
9192
}

src/test/java/com/fasterxml/jackson/databind/interop/IllegalTypesCheckTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.fasterxml.jackson.databind.interop;
22

3+
import org.springframework.jacksontest.BogusApplicationContext;
4+
import org.springframework.jacksontest.BogusPointcutAdvisor;
5+
36
import com.fasterxml.jackson.annotation.JsonTypeInfo;
47
import com.fasterxml.jackson.databind.*;
58

@@ -67,6 +70,10 @@ public void testJDKTypes1855() throws Exception
6770
{
6871
// apparently included by JDK?
6972
_testIllegalType("com.sun.org.apache.bcel.internal.util.ClassLoader");
73+
74+
// also: we can try some form of testing, even if bit contrived...
75+
_testIllegalType(BogusPointcutAdvisor.class);
76+
_testIllegalType(BogusApplicationContext.class);
7077
}
7178

7279
// 17-Aug-2017, tatu: Ideally would test handling of 3rd party types, too,
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.springframework.jacksontest;
2+
3+
public class AbstractApplicationContext {
4+
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.springframework.jacksontest;
2+
3+
public class AbstractPointcutAdvisor {
4+
5+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package org.springframework.jacksontest;
2+
3+
//Made-up test class that should trigger checks for [databind#1855]
4+
public class BogusApplicationContext extends AbstractApplicationContext {
5+
public BogusApplicationContext(String s) {
6+
super();
7+
throw new Error("Wrong!");
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package org.springframework.jacksontest;
2+
3+
// Made-up test class that should trigger checks for [databind#1855]
4+
public class BogusPointcutAdvisor extends AbstractPointcutAdvisor {
5+
public BogusPointcutAdvisor(String s) {
6+
super();
7+
throw new Error("Wrong!");
8+
}
9+
}

0 commit comments

Comments
 (0)