You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2023/01/19 20:09:59 UTC

[tomcat] branch main updated: Fix another test broken when I cleaned up the security manager stuff

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new 47508ce139 Fix another test broken when I cleaned up the security manager stuff
47508ce139 is described below

commit 47508ce13923f3384874277cdea2d26f453c3441
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jan 19 20:09:50 2023 +0000

    Fix another test broken when I cleaned up the security manager stuff
---
 .../org/apache/juli/TestClassLoaderLogManager.java | 24 +++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/test/org/apache/juli/TestClassLoaderLogManager.java b/test/org/apache/juli/TestClassLoaderLogManager.java
index 696af00ccb..0dda55bd03 100644
--- a/test/org/apache/juli/TestClassLoaderLogManager.java
+++ b/test/org/apache/juli/TestClassLoaderLogManager.java
@@ -20,6 +20,9 @@ import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
 import java.util.Collections;
 import java.util.Random;
 import java.util.logging.Level;
@@ -160,7 +163,12 @@ public class TestClassLoaderLogManager {
         }
     }
 
-    private static class TestClassLoader extends ClassLoader implements WebappProperties {
+    private static class TestClassLoader extends URLClassLoader implements WebappProperties {
+
+        public TestClassLoader() {
+            super(new URL[0]);
+        }
+
 
         @Override
         public String getWebappName() {
@@ -182,6 +190,20 @@ public class TestClassLoaderLogManager {
             return true;
         }
 
+        @Override
+        public URL findResource(String name) {
+            if ("logging.properties".equals(name)) {
+                try {
+                    return new URL("file:///path/does/not/exist");
+                } catch (MalformedURLException e) {
+                    // Should never happen
+                    throw new IllegalArgumentException(e);
+                }
+            }
+            return null;
+        }
+
+
         @Override
         public InputStream getResourceAsStream(final String resource) {
             if ("logging.properties".equals(resource)) {


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org