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 9f5df15ea3d3957242558f219da50495481fd342
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Oct 1 15:39:08 2019 +0100

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

diff --git a/java/org/apache/tomcat/util/compat/Jre7Compat.java 
b/java/org/apache/tomcat/util/compat/Jre7Compat.java
index f47c3af..40f4a50 100644
--- a/java/org/apache/tomcat/util/compat/Jre7Compat.java
+++ b/java/org/apache/tomcat/util/compat/Jre7Compat.java
@@ -74,6 +74,8 @@ class Jre7Compat extends JreCompat {
         Method m14 = null;
         Constructor<GZIPOutputStream> c = null;
         try {
+            // Order is important for the error handling below.
+            // Must look up m1 first.
             m1 = Locale.class.getMethod("forLanguageTag", String.class);
             c = GZIPOutputStream.class.getConstructor(OutputStream.class, 
boolean.class);
             m2 = CallableStatement.class.getMethod("getObject", int.class, 
Class.class);
@@ -93,8 +95,13 @@ class Jre7Compat extends JreCompat {
             // Should never happen
             log.error(sm.getString("jre7Compat.unexpected"), e);
         } catch (NoSuchMethodException e) {
-            // Must be pre-Java 7
-            log.debug(sm.getString("jre7Compat.javaPre7"), e);
+            if (m1 == null) {
+                // Must be pre-Java 7
+                log.debug(sm.getString("jre7Compat.javaPre7"), e);
+            } else {
+                // Should never happen - signature error in lookup?
+                log.error(sm.getString("jre7Compat.unexpected"), e);
+            }
         }
         forLanguageTagMethod = m1;
         gzipOutputStreamConstructor = c;


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

Reply via email to