tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject [tomcat] 02/08: Add logging
Date Tue, 01 Oct 2019 14:49:51 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 5290b68f064c44c24e73e07a0dc26582cc38eb5a
Author: Mark Thomas <markt@apache.org>
AuthorDate: Tue Oct 1 14:49:16 2019 +0100

    Add logging
---
 java/org/apache/tomcat/util/compat/Jre8Compat.java         | 14 ++++++++++++--
 java/org/apache/tomcat/util/compat/LocalStrings.properties |  7 +++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/util/compat/Jre8Compat.java b/java/org/apache/tomcat/util/compat/Jre8Compat.java
index 50eb138..274e2a3 100644
--- a/java/org/apache/tomcat/util/compat/Jre8Compat.java
+++ b/java/org/apache/tomcat/util/compat/Jre8Compat.java
@@ -23,8 +23,15 @@ import javax.net.ssl.SSLEngine;
 import javax.net.ssl.SSLParameters;
 import javax.net.ssl.SSLServerSocket;
 
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.res.StringManager;
+
 class Jre8Compat extends Jre7Compat {
 
+    private static final Log log = LogFactory.getLog(Jre8Compat.class);
+    private static final StringManager sm = StringManager.getManager(Jre8Compat.class);
+
     private static final int RUNTIME_MAJOR_VERSION = 8;
 
     private static final Method getSSLParametersMethod;
@@ -45,10 +52,13 @@ class Jre8Compat extends Jre7Compat {
             m3 = SSLServerSocket.class.getMethod("setSSLParameters", c2);
         } catch (SecurityException e) {
             // Should never happen
+            log.error(sm.getString("jre8Compat.unexpected"), e);
         } catch (NoSuchMethodException e) {
-            // Expected on Java < 8
+            // Must be pre-Java 8
+            log.debug(sm.getString("jre8Compat.javaPre8"), e);
         } catch (ClassNotFoundException e) {
-            // Expected on Java < 7
+            // Must be pre-Java 7
+            log.debug(sm.getString("jre8Compat.javaPre7"), e);
         }
         getSSLParametersMethod = m1;
         setUseCipherSuitesOrderMethod = m2;
diff --git a/java/org/apache/tomcat/util/compat/LocalStrings.properties b/java/org/apache/tomcat/util/compat/LocalStrings.properties
index 658bb43..1f671ba 100644
--- a/java/org/apache/tomcat/util/compat/LocalStrings.properties
+++ b/java/org/apache/tomcat/util/compat/LocalStrings.properties
@@ -13,6 +13,13 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+jre7Compat.javaPre7=Method not found so assuming code is running on a pre-Java 7 JVM
+jre7Compat.unexpected=Failed to create references to Java 7 classes and methods
+
+jre8Compat.javaPre7=Class not found so assuming code is running on a pre-Java 7 JVM
+jre8Compat.javaPre8=Method not found so assuming code is running on a pre-Java 8 JVM
+jre8Compat.unexpected=Failed to create references to Java 8 classes and methods
+
 jre9Compat.invalidModuleUri=The module URI provided [{0}] could not be converted to a URL
for the JarScanner to process
 jre9Compat.javaPre9=Class not found so assuming code is running on a pre-Java 9 JVM
 jre9Compat.unexpected=Failed to create references to Java 9 classes and methods


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


Mime
View raw message