Skip to content

Commit 47508ce

Browse files
committed
Fix another test broken when I cleaned up the security manager stuff
1 parent b267fa0 commit 47508ce

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

test/org/apache/juli/TestClassLoaderLogManager.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
import java.io.File;
2121
import java.io.IOException;
2222
import java.io.InputStream;
23+
import java.net.MalformedURLException;
24+
import java.net.URL;
25+
import java.net.URLClassLoader;
2326
import java.util.Collections;
2427
import java.util.Random;
2528
import java.util.logging.Level;
@@ -160,7 +163,12 @@ public void setRunning(boolean running) {
160163
}
161164
}
162165

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+
164172

165173
@Override
166174
public String getWebappName() {
@@ -182,6 +190,20 @@ public boolean hasLoggingConfig() {
182190
return true;
183191
}
184192

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+
185207
@Override
186208
public InputStream getResourceAsStream(final String resource) {
187209
if ("logging.properties".equals(resource)) {

0 commit comments

Comments
 (0)