Improve the fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=49230
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 23 Jun 2010 07:40:19 +0000 (07:40 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 23 Jun 2010 07:40:19 +0000 (07:40 +0000)
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

java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java
java/org/apache/catalina/core/LocalStrings.properties

index b243d83..5a26ee4 100644 (file)
@@ -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);
+                    }
                 }
             }
             
index 6b3dd56..b85aa1f 100644 (file)
@@ -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