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 25735ecd17 Improve handling of EL error messages. 25735ecd17 is described below commit 25735ecd1796116c65bb5125d48d1f79316f2d4c Author: Mark Thomas <ma...@apache.org> AuthorDate: Mon Aug 29 07:39:15 2022 +0100 Improve handling of EL error messages. Ensure instances of Number are not formatted in unexpected ways. --- java/org/apache/el/util/MessageFactory.java | 10 ++++++++++ webapps/docs/changelog.xml | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/java/org/apache/el/util/MessageFactory.java b/java/org/apache/el/util/MessageFactory.java index 9222204b46..20e530d4ef 100644 --- a/java/org/apache/el/util/MessageFactory.java +++ b/java/org/apache/el/util/MessageFactory.java @@ -43,6 +43,16 @@ public final class MessageFactory { public static String get(final String key, final Object... args) { String value = get(key); + // Convert all Number arguments to String else MessageFormat may try to + // format them in unexpected ways. + if (args != null) { + for (int i = 0; i < args.length; i++) { + if (args[i] instanceof Number) { + args[i] = args[i].toString(); + } + } + } + MessageFormat mf = new MessageFormat(value); return mf.format(args, new StringBuffer(), null).toString(); } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 5e689acdb4..cda85a0fcb 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -176,6 +176,10 @@ that is now detrimental rather than helpful. Pull request <pr>547</pr> provided by rmannibucau. (markt) </fix> + <fix> + Improve handling of EL error messages so instances of Number are not + formatted in unexpected ways. (markt) + </fix> </changelog> </subsection> <subsection name="Cluster"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org