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


The following commit(s) were added to refs/heads/8.5.x by this push:
     new 5bcf7fe9dc Better fix for --enable-preview errors. Suggested by Alan 
Bateman
5bcf7fe9dc is described below

commit 5bcf7fe9dc39e81210f81c23bad06d51ff2ce999
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue May 17 13:21:30 2022 +0100

    Better fix for --enable-preview errors. Suggested by Alan Bateman
---
 .../el/TestImportHandlerStandardPackages.java      | 32 ++--------------------
 1 file changed, 2 insertions(+), 30 deletions(-)

diff --git a/test/javax/el/TestImportHandlerStandardPackages.java 
b/test/javax/el/TestImportHandlerStandardPackages.java
index a3ce0b76e8..319922cb2e 100644
--- a/test/javax/el/TestImportHandlerStandardPackages.java
+++ b/test/javax/el/TestImportHandlerStandardPackages.java
@@ -70,15 +70,8 @@ public class TestImportHandlerStandardPackages {
                 }
                 // Extract class name
                 String className = fileName.substring(10, fileName.length() - 
6);
-                Class<?> clazz = null;
-                try {
-                    clazz = Class.forName("java.lang." + className);
-                } catch (Throwable t) {
-                    swallowEnablePreview(className, t);
-                }
-                if (clazz == null) {
-                    continue;
-                }
+                Class<?> clazz = Class.forName("java.lang." + className, false,
+                        
TestImportHandlerStandardPackages.class.getClassLoader());
                 if (!Modifier.isPublic(clazz.getModifiers())) {
                     // Exclude non-public classes
                     continue;
@@ -182,25 +175,4 @@ public class TestImportHandlerStandardPackages {
         }
         return result;
     }
-
-
-    /*
-     * This is a bit of a hack but there isn't a specific exception that can be
-     * caught.
-     */
-    private void swallowEnablePreview(String className, Throwable t) {
-        while (t != null) {
-            if (t.getMessage() != null && 
t.getMessage().contains("--enable-preview")) {
-                return;
-            }
-
-            Throwable cause = t.getCause();
-            if (t == cause) {
-                break;
-            }
-            t = cause;
-        }
-
-        throw new RuntimeException(className, t);
-    }
 }


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

Reply via email to