Mark,

On 8/29/22 02:39, ma...@apache.org wrote:
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 ea17c9d61b Improve handling of EL error messages.
ea17c9d61b is described below

commit ea17c9d61baf665d4bf5bd4b7f419b0c705c9abe
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 40f2ddeb4c..fc6b28a602 100644
--- a/java/org/apache/el/util/MessageFactory.java
+++ b/java/org/apache/el/util/MessageFactory.java
@@ -42,6 +42,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();
+                       }
+               }
+        }
+

This might represent a big change in behavior, especially with floating-point numbers. I'm not sure what role MessageFormat plays in the whole EL ecosystem... is it any part of the spec, or only for like error messages and things like that?

-chris

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

Reply via email to