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 2019/10/01 14:18:59 UTC

[tomcat] branch 8.5.x updated (a7e6a5d -> 7c15360)

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

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


    from a7e6a5d  Add logging
     new 0bcf094  Try and detect bugs like BZ 63778
     new 7c15360  Try and detect bugs like BZ 63778

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 java/org/apache/tomcat/util/compat/Jre8Compat.java | 12 ++++++++++--
 java/org/apache/tomcat/util/compat/Jre9Compat.java | 14 +++++++++++---
 2 files changed, 21 insertions(+), 5 deletions(-)


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


[tomcat] 02/02: Try and detect bugs like BZ 63778

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7c15360234d03ee308ee6c8fe42c5442e8be5e36
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Oct 1 15:18:44 2019 +0100

    Try and detect bugs like BZ 63778
---
 java/org/apache/tomcat/util/compat/Jre8Compat.java | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/util/compat/Jre8Compat.java b/java/org/apache/tomcat/util/compat/Jre8Compat.java
index a29abcd..e76ac35 100644
--- a/java/org/apache/tomcat/util/compat/Jre8Compat.java
+++ b/java/org/apache/tomcat/util/compat/Jre8Compat.java
@@ -46,6 +46,9 @@ class Jre8Compat extends JreCompat {
         Method m1 = null;
         Constructor<?> c2 = null;
         try {
+            // Order is important for the error handling below.
+            // Must look up m1 first.
+
             // The class is Java6+...
             Class<?> clazz1 = Class.forName("javax.net.ssl.SSLParameters");
             // ...but this method is Java8+
@@ -56,8 +59,13 @@ class Jre8Compat extends JreCompat {
             // Should never happen
             log.error(sm.getString("jre8Compat.unexpected"), e);
         } catch (NoSuchMethodException e) {
-            // Must be pre-Java 8
-            log.debug(sm.getString("jre8Compat.javaPre8"), e);
+            if (m1 == null) {
+                // Must be pre-Java 8
+                log.debug(sm.getString("jre8Compat.javaPre8"), e);
+            } else {
+                // Should never happen - signature error in lookup?
+                log.error(sm.getString("jre8Compat.unexpected"), e);
+            }
         } catch (ClassNotFoundException e) {
             // Should never happen
             log.error(sm.getString("jre8Compat.unexpected"), e);


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


[tomcat] 01/02: Try and detect bugs like BZ 63778

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 0bcf094a2d25429f67c79ac8f32b0227a94a2016
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Oct 1 15:14:08 2019 +0100

    Try and detect bugs like BZ 63778
---
 java/org/apache/tomcat/util/compat/Jre9Compat.java | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/tomcat/util/compat/Jre9Compat.java b/java/org/apache/tomcat/util/compat/Jre9Compat.java
index 7ad6f66..3bbdd12 100644
--- a/java/org/apache/tomcat/util/compat/Jre9Compat.java
+++ b/java/org/apache/tomcat/util/compat/Jre9Compat.java
@@ -77,6 +77,10 @@ class Jre9Compat extends Jre8Compat {
         Object o15 = null;
 
         try {
+            // Order is important for the error handling below.
+            // Must look up c1 first.
+            c1 = Class.forName("java.lang.reflect.InaccessibleObjectException");
+
             Class<?> moduleLayerClazz = Class.forName("java.lang.ModuleLayer");
             Class<?> configurationClazz = Class.forName("java.lang.module.Configuration");
             Class<?> resolvedModuleClazz = Class.forName("java.lang.module.ResolvedModule");
@@ -86,7 +90,6 @@ class Jre9Compat extends Jre8Compat {
             Method runtimeVersionMethod = JarFile.class.getMethod("runtimeVersion");
             Method majorMethod = versionClazz.getMethod("major");
 
-            c1 = Class.forName("java.lang.reflect.InaccessibleObjectException");
             m2 = SSLParameters.class.getMethod("setApplicationProtocols", String[].class);
             m3 = SSLEngine.class.getMethod("getApplicationProtocol");
             m4 = URLConnection.class.getMethod("setDefaultUseCaches", String.class, boolean.class);
@@ -103,8 +106,13 @@ class Jre9Compat extends Jre8Compat {
             o15 = majorMethod.invoke(o14);
 
         } catch (ClassNotFoundException e) {
-            // Must be pre-Java 9
-            log.debug(sm.getString("jre9Compat.javaPre9"), e);
+            if (c1 == null) {
+                // Must be pre-Java 9
+                log.debug(sm.getString("jre9Compat.javaPre9"), e);
+            } else {
+                // Should never happen - signature error in lookup?
+                log.error(sm.getString("jre9Compat.unexpected"), e);
+            }
         } catch (ReflectiveOperationException | IllegalArgumentException e) {
             // Should never happen
             log.error(sm.getString("jre9Compat.unexpected"), e);


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