Skip to content

Commit

Permalink
Fix issues with earlier fix for #1855
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Dec 19, 2017
1 parent 6743953 commit bb45fb1
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 2 deletions.
Expand Up @@ -71,6 +71,7 @@ public void validateSubType(DeserializationContext ctxt, JavaType type) throws J
final Class<?> raw = type.getRawClass();
String full = raw.getName();

main_check:
do {
if (_cfgIllegalClassNames.contains(full)) {
break;
Expand All @@ -84,8 +85,8 @@ public void validateSubType(DeserializationContext ctxt, JavaType type) throws J
// looking for "AbstractBeanFactoryPointcutAdvisor" but no point to allow any is there?
if ("AbstractPointcutAdvisor".equals(name)
// ditto for "FileSystemXmlApplicationContext": block all ApplicationContexts
|| "AbstractApplicationContext.equals".equals(name)) {
break;
|| "AbstractApplicationContext".equals(name)) {
break main_check;
}
}
}
Expand Down
@@ -1,5 +1,8 @@
package com.fasterxml.jackson.databind.interop;

import org.springframework.jacksontest.BogusApplicationContext;
import org.springframework.jacksontest.BogusPointcutAdvisor;

import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.*;

Expand Down Expand Up @@ -67,6 +70,10 @@ public void testJDKTypes1855() throws Exception
{
// apparently included by JDK?
_testIllegalType("com.sun.org.apache.bcel.internal.util.ClassLoader");

// also: we can try some form of testing, even if bit contrived...
_testIllegalType(BogusPointcutAdvisor.class);
_testIllegalType(BogusApplicationContext.class);
}

// 17-Aug-2017, tatu: Ideally would test handling of 3rd party types, too,
Expand Down
@@ -0,0 +1,5 @@
package org.springframework.jacksontest;

public class AbstractApplicationContext {

}
@@ -0,0 +1,5 @@
package org.springframework.jacksontest;

public class AbstractPointcutAdvisor {

}
@@ -0,0 +1,9 @@
package org.springframework.jacksontest;

//Made-up test class that should trigger checks for [databind#1855]
public class BogusApplicationContext extends AbstractApplicationContext {
public BogusApplicationContext(String s) {
super();
throw new Error("Wrong!");
}
}
@@ -0,0 +1,9 @@
package org.springframework.jacksontest;

// Made-up test class that should trigger checks for [databind#1855]
public class BogusPointcutAdvisor extends AbstractPointcutAdvisor {
public BogusPointcutAdvisor(String s) {
super();
throw new Error("Wrong!");
}
}

0 comments on commit bb45fb1

Please sign in to comment.