This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new 55b8f13be6 Better fix for --enable-preview errors. Suggested by Alan Bateman 55b8f13be6 is described below commit 55b8f13be647e698032e84a7ea9c4dbf21ac5847 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 | 27 ++-------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/test/jakarta/el/TestImportHandlerStandardPackages.java b/test/jakarta/el/TestImportHandlerStandardPackages.java index 8d7def7005..ebd2d8610b 100644 --- a/test/jakarta/el/TestImportHandlerStandardPackages.java +++ b/test/jakarta/el/TestImportHandlerStandardPackages.java @@ -62,12 +62,10 @@ public class TestImportHandlerStandardPackages { .map(c -> c.substring(10, c.length() - 6)) // Extract class name .map(c-> { try { - return Class.forName("java.lang." + c); // Get the class object + return Class.forName("java.lang." + c, false, + TesterImportHandlerPerformance.class.getClassLoader()); // Get the class object } catch (ClassNotFoundException e) { throw new RuntimeException(c); - } catch (Throwable t) { - swallowEnablePreview(c, t); - return null; } }) .filter(c -> null != c) @@ -133,25 +131,4 @@ public class TestImportHandlerStandardPackages { } } } - - - /* - * 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