File tree 1 file changed +23
-1
lines changed
1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change 20
20
import java .io .File ;
21
21
import java .io .IOException ;
22
22
import java .io .InputStream ;
23
+ import java .net .MalformedURLException ;
24
+ import java .net .URL ;
25
+ import java .net .URLClassLoader ;
23
26
import java .util .Collections ;
24
27
import java .util .Random ;
25
28
import java .util .logging .Level ;
@@ -160,7 +163,12 @@ public void setRunning(boolean running) {
160
163
}
161
164
}
162
165
163
- private static class TestClassLoader extends ClassLoader implements WebappProperties {
166
+ private static class TestClassLoader extends URLClassLoader implements WebappProperties {
167
+
168
+ public TestClassLoader () {
169
+ super (new URL [0 ]);
170
+ }
171
+
164
172
165
173
@ Override
166
174
public String getWebappName () {
@@ -182,6 +190,20 @@ public boolean hasLoggingConfig() {
182
190
return true ;
183
191
}
184
192
193
+ @ Override
194
+ public URL findResource (String name ) {
195
+ if ("logging.properties" .equals (name )) {
196
+ try {
197
+ return new URL ("file:///path/does/not/exist" );
198
+ } catch (MalformedURLException e ) {
199
+ // Should never happen
200
+ throw new IllegalArgumentException (e );
201
+ }
202
+ }
203
+ return null ;
204
+ }
205
+
206
+
185
207
@ Override
186
208
public InputStream getResourceAsStream (final String resource ) {
187
209
if ("logging.properties" .equals (resource )) {
You can’t perform that action at this time.
0 commit comments