From afa736c7dd71cae8c1f9de212237ee05b51f6783 Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 23 Jun 2010 07:40:19 +0000 Subject: [PATCH] Improve the fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=49230 Don't log an error about loading Sun class on non-Sun JVMs. Use i18n for message. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@957130 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/catalina/core/JreMemoryLeakPreventionListener.java | 9 +++++++-- java/org/apache/catalina/core/LocalStrings.properties | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java b/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java index b243d83fa..5a26ee445 100644 --- a/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java +++ b/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java @@ -201,8 +201,13 @@ public class JreMemoryLeakPreventionListener implements LifecycleListener { try { Class.forName("sun.net.www.http.HttpClient"); } catch (ClassNotFoundException e) { - log.error("Could not prevent sun.net.www.http.HttpClient" + - " from being loaded.", e); + if (System.getProperty("java.vendor").startsWith("Sun")) { + log.error(sm.getString( + "jreLeakListener.keepAliveFail"), e); + } else { + log.debug(sm.getString( + "jreLeakListener.keepAliveFail"), e); + } } } diff --git a/java/org/apache/catalina/core/LocalStrings.properties b/java/org/apache/catalina/core/LocalStrings.properties index 6b3dd5682..b85aa1fed 100644 --- a/java/org/apache/catalina/core/LocalStrings.properties +++ b/java/org/apache/catalina/core/LocalStrings.properties @@ -76,6 +76,7 @@ httpEngineMapper.container=This container is not a StandardEngine httpHostMapper.container=This container is not a StandardHost interceptorValve.alreadyStarted=InterceptorValve has already been started interceptorValve.notStarted=InterceptorValve has not yet been started +jreLeakListener.keepAliveFail=Failed to trigger creation of the sun.net.www.http.HttpClient class during Tomcat start to prevent possible memory leaks. This is expected on non-Sun JVMs. jreLeakListener.gcDaemonFail=Failed to trigger creation of the GC Daemon thread during Tomcat start to prevent possible memory leaks. This is expected on non-Sun JVMs. jreLeakListener.jarUrlConnCacheFail=Failed to disable Jar URL connection caching by default jreLeakListener.xmlParseFail=Error whilst attempting to prevent memory leaks during XML parsing -- 2.11.0