From cfa1c1e2e46bf1835c949f3c77bf5458452f631f Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Fri, 30 Nov 2012 07:56:38 +1100 Subject: [PATCH] 395394 allow logging from boot classloader --- .../src/main/java/org/eclipse/jetty/util/Loader.java | 1 - .../src/main/java/org/eclipse/jetty/util/log/Log.java | 4 ++-- .../org/eclipse/jetty/util/resource/Resource.java | 11 +---------- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/Loader.java b/jetty-util/src/main/java/org/eclipse/jetty/util/Loader.java index 2c25bfc4510..fed6bbcaddf 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/Loader.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/Loader.java @@ -47,7 +47,6 @@ public class Loader { /* ------------------------------------------------------------ */ public static URL getResource(Class loadClass,String name, boolean checkParents) - throws ClassNotFoundException { URL url =null; ClassLoader loader=Thread.currentThread().getContextClassLoader(); diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java index ab2486ea935..cf3030be4e6 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java @@ -91,7 +91,7 @@ public class Log * configuration of the Log class in situations where access to the System.properties are * either too late or just impossible. */ - URL testProps = Log.class.getClassLoader().getResource("jetty-logging.properties"); + URL testProps = Loader.getResource(Log.class,"jetty-logging.properties",true); if (testProps != null) { InputStream in = null; @@ -234,7 +234,7 @@ public class Log public static void setLogToParent(String name) { ClassLoader loader = Log.class.getClassLoader(); - if (loader.getParent()!=null) + if (loader!=null && loader.getParent()!=null) { try { diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java index 90944a1cb72..d9c525b1f29 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java @@ -298,16 +298,7 @@ public abstract class Resource implements ResourceFactory URL url=Resource.class.getResource(name); if (url==null) - { - try - { - url=Loader.getResource(Resource.class,name,checkParents); - } - catch(ClassNotFoundException e) - { - url=ClassLoader.getSystemResource(name); - } - } + url=Loader.getResource(Resource.class,name,checkParents); if (url==null) return null; return newResource(url,useCaches);