This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 11.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit beac6b0157d2187b7e0c8d4455b0be6dc1c03072 Author: remm <r...@apache.org> AuthorDate: Thu Mar 20 22:17:27 2025 +0100 Java 17 fix --- java/org/apache/el/lang/ELSupport.java | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/java/org/apache/el/lang/ELSupport.java b/java/org/apache/el/lang/ELSupport.java index e9a6ad4ac5..f80ddd15fb 100644 --- a/java/org/apache/el/lang/ELSupport.java +++ b/java/org/apache/el/lang/ELSupport.java @@ -457,22 +457,23 @@ public class ELSupport { } } - return switch (obj) { - case null -> ""; - case String s -> s; - case Enum<?> anEnum -> anEnum.name(); - default -> { - try { - yield obj.toString(); - } catch (ELException e) { - // Unlikely but you never know - throw e; - } catch (Throwable t) { - ExceptionUtils.handleThrowable(t); - throw new ELException(t); - } + if (obj == null) { + return ""; + } else if (obj instanceof String) { + return (String) obj; + } else if (obj instanceof Enum<?>) { + return ((Enum<?>) obj).name(); + } else { + try { + return obj.toString(); + } catch (ELException e) { + // Unlikely but you never know + throw e; + } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); + throw new ELException(t); } - }; + } } public static <T> T coerceToType(final ELContext ctx, final Object obj, final Class<T> type) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org