1818 */
1919public class SubTypeValidator
2020{
21- protected final static String PREFIX_STRING = "org.springframework." ;
21+ protected final static String PREFIX_SPRING = "org.springframework." ;
22+
23+ protected final static String PREFIX_C3P0 = "com.mchange.v2.c3p0." ;
24+
2225 /**
2326 * Set of well-known "nasty classes", deserialization of which is considered dangerous
2427 * and should (and is) prevented by default.
@@ -45,8 +48,9 @@ public class SubTypeValidator
4548 // [databind#1737]; 3rd party
4649//s.add("org.springframework.aop.support.AbstractBeanFactoryPointcutAdvisor"); // deprecated by [databind#1855]
4750 s .add ("org.springframework.beans.factory.config.PropertyPathFactoryBean" );
48- s .add ("com.mchange.v2.c3p0.JndiRefForwardingDataSource" );
49- s .add ("com.mchange.v2.c3p0.WrapperConnectionPoolDataSource" );
51+
52+ // s.add("com.mchange.v2.c3p0.JndiRefForwardingDataSource"); // deprecated by [databind#1931]
53+ // s.add("com.mchange.v2.c3p0.WrapperConnectionPoolDataSource"); // - "" -
5054 // [databind#1855]: more 3rd party
5155 s .add ("org.apache.tomcat.dbcp.dbcp2.BasicDataSource" );
5256 s .add ("com.sun.org.apache.bcel.internal.util.ClassLoader" );
@@ -84,8 +88,10 @@ public void validateSubType(DeserializationContext ctxt, JavaType type) throws J
8488 // 18-Dec-2017, tatu: As per [databind#1855], need bit more sophisticated handling
8589 // for some Spring framework types
8690 // 05-Jan-2017, tatu: ... also, only applies to classes, not interfaces
87- if (!raw .isInterface () && full .startsWith (PREFIX_STRING )) {
88- for (Class <?> cls = raw ; (cls != null ) && (cls != Object .class ); cls = cls .getSuperclass ()) {
91+ if (raw .isInterface ()) {
92+ ;
93+ } else if (full .startsWith (PREFIX_SPRING )) {
94+ for (Class <?> cls = raw ; (cls != null ) && (cls != Object .class ); cls = cls .getSuperclass ()){
8995 String name = cls .getSimpleName ();
9096 // looking for "AbstractBeanFactoryPointcutAdvisor" but no point to allow any is there?
9197 if ("AbstractPointcutAdvisor" .equals (name )
@@ -94,6 +100,16 @@ public void validateSubType(DeserializationContext ctxt, JavaType type) throws J
94100 break main_check ;
95101 }
96102 }
103+ } else if (full .startsWith (PREFIX_C3P0 )) {
104+ // [databind#1737]; more 3rd party
105+ // s.add("com.mchange.v2.c3p0.JndiRefForwardingDataSource");
106+ // s.add("com.mchange.v2.c3p0.WrapperConnectionPoolDataSource");
107+ // [databind#1931]; more 3rd party
108+ // com.mchange.v2.c3p0.ComboPooledDataSource
109+ // com.mchange.v2.c3p0.debug.AfterCloseLoggingComboPooledDataSource
110+ if (full .endsWith ("DataSource" )) {
111+ break main_check ;
112+ }
97113 }
98114 return ;
99115 } while (false );
0 commit comments