File tree 2 files changed +11
-0
lines changed
main/java/ch/qos/logback/classic/util
test/java/ch/qos/logback/classic/util
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,10 @@ public void autoConfig(ClassLoader classLoader) throws JoranException {
100
100
}
101
101
102
102
private Configurator instantiateConfiguratorByClassName (String configuratorClassName , ClassLoader classLoader ) {
103
+ if (classLoader == null ) {
104
+ contextAware .addInfo ("Instantiation failure: null ClassLoader" );
105
+ return null ;
106
+ }
103
107
try {
104
108
Class <?> classObj = classLoader .loadClass (configuratorClassName );
105
109
return (Configurator ) classObj .getConstructor ().newInstance ();
Original file line number Diff line number Diff line change @@ -122,6 +122,13 @@ public void autoConfigFromServiceLoaderJDK6andAbove() throws Exception {
122
122
assertSame (loggerContext , MockConfigurator .context );
123
123
}
124
124
125
+ @ Test
126
+ public void autoConfigFromBootstrapClassLoader () throws Exception {
127
+ assertNull (MockConfigurator .context );
128
+ new ContextInitializer (loggerContext ).autoConfig (null );
129
+ assertNull (MockConfigurator .context );
130
+ }
131
+
125
132
@ Test
126
133
public void autoConfigFromServiceLoaderJDK5 () throws Exception {
127
134
assumeTrue (isJDK5 ());
You can’t perform that action at this time.
0 commit comments