[tomcat] branch 8.5.x updated: EL spec requires remainder() rather than mod()

2022-08-31 Thread markt
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 93f0bcb6bb EL spec requires remainder() rather than mod()
93f0bcb6bb is described below

commit 93f0bcb6bba690d994275345fe950a3024b4e0a8
Author: Mark Thomas 
AuthorDate: Wed Aug 31 20:49:29 2022 +0100

EL spec requires remainder() rather than mod()
---
 java/org/apache/el/lang/ELArithmetic.java | 2 +-
 test/org/apache/el/lang/TestELArithmetic.java | 8 
 webapps/docs/changelog.xml| 6 ++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/el/lang/ELArithmetic.java 
b/java/org/apache/el/lang/ELArithmetic.java
index 59506a5a7b..463772bbc4 100644
--- a/java/org/apache/el/lang/ELArithmetic.java
+++ b/java/org/apache/el/lang/ELArithmetic.java
@@ -113,7 +113,7 @@ public abstract class ELArithmetic {
 
 @Override
 protected Number mod(Number num0, Number num1) {
-return ((BigInteger) num0).mod((BigInteger) num1);
+return ((BigInteger) num0).remainder((BigInteger) num1);
 }
 
 @Override
diff --git a/test/org/apache/el/lang/TestELArithmetic.java 
b/test/org/apache/el/lang/TestELArithmetic.java
index bd47393c1b..14fc27aacc 100644
--- a/test/org/apache/el/lang/TestELArithmetic.java
+++ b/test/org/apache/el/lang/TestELArithmetic.java
@@ -94,6 +94,14 @@ public class TestELArithmetic {
 Assert.assertEquals(Long.valueOf(0), result);
 }
 
+@Test
+public void testMod03() {
+ELProcessor processor = new ELProcessor();
+// Large so BigInteger rather than Long is used internally
+BigInteger result = (BigInteger) processor.eval("1 % 
-999");
+Assert.assertEquals(BigInteger.valueOf(1), result);
+}
+
 @Test
 public void testUnaryMinus01() {
 ELProcessor processor = new ELProcessor();
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 38625188aa..5f39785f6c 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -194,6 +194,12 @@
 error when invoking a static method on an instance of the class rather
 than directly on the class. (markt)
   
+  
+Use BigInteger.remainder() rather than
+BigInteger.mod() when performing the modulus operation for
+instances of BigInteger as part of an EL expression.
+(markt)
+  
 
   
   


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



[tomcat] branch 9.0.x updated: Add required cast

2022-08-31 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 7d70ea4b01 Add required cast
7d70ea4b01 is described below

commit 7d70ea4b01bb269b159241b49c80a4a516cd34e2
Author: Mark Thomas 
AuthorDate: Wed Aug 31 20:54:17 2022 +0100

Add required cast
---
 test/org/apache/el/lang/TestELArithmetic.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/org/apache/el/lang/TestELArithmetic.java 
b/test/org/apache/el/lang/TestELArithmetic.java
index 1daa02fa7d..14fc27aacc 100644
--- a/test/org/apache/el/lang/TestELArithmetic.java
+++ b/test/org/apache/el/lang/TestELArithmetic.java
@@ -98,7 +98,7 @@ public class TestELArithmetic {
 public void testMod03() {
 ELProcessor processor = new ELProcessor();
 // Large so BigInteger rather than Long is used internally
-BigInteger result = processor.eval("1 % -999");
+BigInteger result = (BigInteger) processor.eval("1 % 
-999");
 Assert.assertEquals(BigInteger.valueOf(1), result);
 }
 


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



[tomcat] branch 10.0.x updated: Add required cast

2022-08-31 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new 501927195e Add required cast
501927195e is described below

commit 501927195e1576b56c02152a622329499a0ce819
Author: Mark Thomas 
AuthorDate: Wed Aug 31 20:54:17 2022 +0100

Add required cast
---
 test/org/apache/el/lang/TestELArithmetic.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/org/apache/el/lang/TestELArithmetic.java 
b/test/org/apache/el/lang/TestELArithmetic.java
index afefa71aed..2793424e82 100644
--- a/test/org/apache/el/lang/TestELArithmetic.java
+++ b/test/org/apache/el/lang/TestELArithmetic.java
@@ -98,7 +98,7 @@ public class TestELArithmetic {
 public void testMod03() {
 ELProcessor processor = new ELProcessor();
 // Large so BigInteger rather than Long is used internally
-BigInteger result = processor.eval("1 % -999");
+BigInteger result = (BigInteger) processor.eval("1 % 
-999");
 Assert.assertEquals(BigInteger.valueOf(1), result);
 }
 


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



[tomcat] branch 9.0.x updated: EL spec requires remainder() rather than mod()

2022-08-31 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 56cb1be6bf EL spec requires remainder() rather than mod()
56cb1be6bf is described below

commit 56cb1be6bf7b784d191978c944bda53332ade296
Author: Mark Thomas 
AuthorDate: Wed Aug 31 20:49:29 2022 +0100

EL spec requires remainder() rather than mod()
---
 java/org/apache/el/lang/ELArithmetic.java | 2 +-
 test/org/apache/el/lang/TestELArithmetic.java | 8 
 webapps/docs/changelog.xml| 6 ++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/el/lang/ELArithmetic.java 
b/java/org/apache/el/lang/ELArithmetic.java
index 59506a5a7b..463772bbc4 100644
--- a/java/org/apache/el/lang/ELArithmetic.java
+++ b/java/org/apache/el/lang/ELArithmetic.java
@@ -113,7 +113,7 @@ public abstract class ELArithmetic {
 
 @Override
 protected Number mod(Number num0, Number num1) {
-return ((BigInteger) num0).mod((BigInteger) num1);
+return ((BigInteger) num0).remainder((BigInteger) num1);
 }
 
 @Override
diff --git a/test/org/apache/el/lang/TestELArithmetic.java 
b/test/org/apache/el/lang/TestELArithmetic.java
index bd47393c1b..1daa02fa7d 100644
--- a/test/org/apache/el/lang/TestELArithmetic.java
+++ b/test/org/apache/el/lang/TestELArithmetic.java
@@ -94,6 +94,14 @@ public class TestELArithmetic {
 Assert.assertEquals(Long.valueOf(0), result);
 }
 
+@Test
+public void testMod03() {
+ELProcessor processor = new ELProcessor();
+// Large so BigInteger rather than Long is used internally
+BigInteger result = processor.eval("1 % -999");
+Assert.assertEquals(BigInteger.valueOf(1), result);
+}
+
 @Test
 public void testUnaryMinus01() {
 ELProcessor processor = new ELProcessor();
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index eb0f1efd52..70eb12e173 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -247,6 +247,12 @@
 error when invoking a static method on an instance of the class rather
 than directly on the class. (markt)
   
+  
+Use BigInteger.remainder() rather than
+BigInteger.mod() when performing the modulus operation for
+instances of BigInteger as part of an EL expression.
+(markt)
+  
 
   
   


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



[tomcat] branch 10.0.x updated: EL spec requires remainder() rather than mod()

2022-08-31 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new 4fcef12677 EL spec requires remainder() rather than mod()
4fcef12677 is described below

commit 4fcef12677234400e73e43f82fdb987916e2489b
Author: Mark Thomas 
AuthorDate: Wed Aug 31 20:49:29 2022 +0100

EL spec requires remainder() rather than mod()
---
 java/org/apache/el/lang/ELArithmetic.java | 2 +-
 test/org/apache/el/lang/TestELArithmetic.java | 8 
 webapps/docs/changelog.xml| 6 ++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/el/lang/ELArithmetic.java 
b/java/org/apache/el/lang/ELArithmetic.java
index 65194cc2e3..70538619c0 100644
--- a/java/org/apache/el/lang/ELArithmetic.java
+++ b/java/org/apache/el/lang/ELArithmetic.java
@@ -113,7 +113,7 @@ public abstract class ELArithmetic {
 
 @Override
 protected Number mod(Number num0, Number num1) {
-return ((BigInteger) num0).mod((BigInteger) num1);
+return ((BigInteger) num0).remainder((BigInteger) num1);
 }
 
 @Override
diff --git a/test/org/apache/el/lang/TestELArithmetic.java 
b/test/org/apache/el/lang/TestELArithmetic.java
index 6c4e80c108..afefa71aed 100644
--- a/test/org/apache/el/lang/TestELArithmetic.java
+++ b/test/org/apache/el/lang/TestELArithmetic.java
@@ -94,6 +94,14 @@ public class TestELArithmetic {
 Assert.assertEquals(Long.valueOf(0), result);
 }
 
+@Test
+public void testMod03() {
+ELProcessor processor = new ELProcessor();
+// Large so BigInteger rather than Long is used internally
+BigInteger result = processor.eval("1 % -999");
+Assert.assertEquals(BigInteger.valueOf(1), result);
+}
+
 @Test
 public void testUnaryMinus01() {
 ELProcessor processor = new ELProcessor();
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 60fba6ef8d..6a7b4ec823 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -244,6 +244,12 @@
 error when invoking a static method on an instance of the class rather
 than directly on the class. (markt)
   
+  
+Use BigInteger.remainder() rather than
+BigInteger.mod() when performing the modulus operation for
+instances of BigInteger as part of an EL expression.
+(markt)
+  
 
   
   


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



[tomcat] branch main updated: EL spec requires remainder() rather than mod()

2022-08-31 Thread markt
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 71160c5aa2 EL spec requires remainder() rather than mod()
71160c5aa2 is described below

commit 71160c5aa2fe0b331d48443294d0371980f746ab
Author: Mark Thomas 
AuthorDate: Wed Aug 31 20:49:29 2022 +0100

EL spec requires remainder() rather than mod()
---
 java/org/apache/el/lang/ELArithmetic.java | 2 +-
 test/org/apache/el/lang/TestELArithmetic.java | 8 
 webapps/docs/changelog.xml| 6 ++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/el/lang/ELArithmetic.java 
b/java/org/apache/el/lang/ELArithmetic.java
index 65194cc2e3..70538619c0 100644
--- a/java/org/apache/el/lang/ELArithmetic.java
+++ b/java/org/apache/el/lang/ELArithmetic.java
@@ -113,7 +113,7 @@ public abstract class ELArithmetic {
 
 @Override
 protected Number mod(Number num0, Number num1) {
-return ((BigInteger) num0).mod((BigInteger) num1);
+return ((BigInteger) num0).remainder((BigInteger) num1);
 }
 
 @Override
diff --git a/test/org/apache/el/lang/TestELArithmetic.java 
b/test/org/apache/el/lang/TestELArithmetic.java
index 800d8ea6d4..fd9ec2c029 100644
--- a/test/org/apache/el/lang/TestELArithmetic.java
+++ b/test/org/apache/el/lang/TestELArithmetic.java
@@ -94,6 +94,14 @@ public class TestELArithmetic {
 Assert.assertEquals(Long.valueOf(0), result);
 }
 
+@Test
+public void testMod03() {
+ELProcessor processor = new ELProcessor();
+// Large so BigInteger rather than Long is used internally
+BigInteger result = processor.eval("1 % -999");
+Assert.assertEquals(BigInteger.valueOf(1), result);
+}
+
 @Test
 public void testUnaryMinus01() {
 ELProcessor processor = new ELProcessor();
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index e43b8f5c60..17818032ed 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -244,6 +244,12 @@
 error when invoking a static method on an instance of the class rather
 than directly on the class. (markt)
   
+  
+Use BigInteger.remainder() rather than
+BigInteger.mod() when performing the modulus operation for
+instances of BigInteger as part of an EL expression.
+(markt)
+  
 
   
   


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



[tomcat] branch 8.5.x updated: Fix MethodExpression when accessing static method via an instance

2022-08-31 Thread markt
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 f8ce492251 Fix MethodExpression when accessing static method via an 
instance
f8ce492251 is described below

commit f8ce49225132131f42f8a8b89f7148c8224bf442
Author: Mark Thomas 
AuthorDate: Wed Aug 31 16:33:49 2022 +0100

Fix MethodExpression when accessing static method via an instance
---
 java/javax/el/Util.java |  4 +---
 java/org/apache/el/util/ReflectionUtil.java |  5 ++---
 test/org/apache/el/util/TestReflectionUtil.java | 25 +
 webapps/docs/changelog.xml  |  5 +
 4 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/java/javax/el/Util.java b/java/javax/el/Util.java
index d169839794..7e7812a102 100644
--- a/java/javax/el/Util.java
+++ b/java/javax/el/Util.java
@@ -546,11 +546,9 @@ class Util {
  */
 static Method getMethod(Class type, Object base, Method m) {
 JreCompat jreCompat = JreCompat.getInstance();
-// If base is null, method MUST be static
-// If base is non-null, method may be static or non-static
 if (m == null ||
 (Modifier.isPublic(type.getModifiers()) &&
-(jreCompat.canAccess(base, m) || base != null && 
jreCompat.canAccess(null, m {
+(Modifier.isStatic(m.getModifiers()) && 
jreCompat.canAccess(null, m) || jreCompat.canAccess(base, m {
 return m;
 }
 Class[] interfaces = type.getInterfaces();
diff --git a/java/org/apache/el/util/ReflectionUtil.java 
b/java/org/apache/el/util/ReflectionUtil.java
index c1162d1897..635c906123 100644
--- a/java/org/apache/el/util/ReflectionUtil.java
+++ b/java/org/apache/el/util/ReflectionUtil.java
@@ -430,11 +430,10 @@ public class ReflectionUtil {
  */
 private static Method getMethod(Class type, Object base, Method m) {
 JreCompat jreCompat = JreCompat.getInstance();
-// If base is null, method MUST be static
-// If base is non-null, method may be static or non-static
 if (m == null ||
 (Modifier.isPublic(type.getModifiers()) &&
-(jreCompat.canAccess(base, m) || base != null && 
jreCompat.canAccess(null, m {
+(Modifier.isStatic(m.getModifiers()) && 
jreCompat.canAccess(null, m)
+|| jreCompat.canAccess(base, m {
 return m;
 }
 Class[] interfaces = type.getInterfaces();
diff --git a/test/org/apache/el/util/TestReflectionUtil.java 
b/test/org/apache/el/util/TestReflectionUtil.java
index f39ae85467..ffac25b3bd 100644
--- a/test/org/apache/el/util/TestReflectionUtil.java
+++ b/test/org/apache/el/util/TestReflectionUtil.java
@@ -16,10 +16,16 @@
  */
 package org.apache.el.util;
 
+import javax.el.ELContext;
+import javax.el.ExpressionFactory;
+import javax.el.MethodExpression;
 import javax.el.MethodNotFoundException;
 
+import org.junit.Assert;
 import org.junit.Test;
 
+import org.apache.jasper.el.ELContextImpl;
+
 public class TestReflectionUtil {
 
 private static final Tester BASE = new Tester();
@@ -60,4 +66,23 @@ public class TestReflectionUtil {
 new Class[] {null},
 new Object[] {null});
 }
+
+@Test
+public void testStaticMethodOnInstance() {
+ExpressionFactory factory = ExpressionFactory.newInstance();
+ELContext context = new ELContextImpl(factory);
+
+MethodExpression methodExpression =
+factory.createMethodExpression(context, "${\"1\".format(2)}", 
String.class, new Class[] {});
+
+try {
+methodExpression.invoke(context, null);
+} catch (IllegalArgumentException iae) {
+// Ensure correct IllegalArgumentException is thrown
+String msg = iae.getMessage();
+Assert.assertTrue(msg, msg.contains("[format]"));
+return;
+}
+Assert.fail("No exception");
+}
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index ccdc313a7b..38625188aa 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -189,6 +189,11 @@
 type conversion fails during an EL arithmetic operation. This is an EL
 error so ELException seems more appropriate. (markt)
   
+  
+Fix a bug in MethodExpression handling that triggered an
+error when invoking a static method on an instance of the class rather
+than directly on the class. (markt)
+  
 
   
   


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



[tomcat] branch 9.0.x updated: Fix MethodExpression when accessing static method via an instance

2022-08-31 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new d5a02603c5 Fix MethodExpression when accessing static method via an 
instance
d5a02603c5 is described below

commit d5a02603c5391eed353d5b0afd7973081fcb6183
Author: Mark Thomas 
AuthorDate: Wed Aug 31 16:33:49 2022 +0100

Fix MethodExpression when accessing static method via an instance
---
 java/javax/el/Util.java |  4 +---
 java/org/apache/el/util/ReflectionUtil.java |  5 ++---
 test/org/apache/el/util/TestReflectionUtil.java | 25 +
 webapps/docs/changelog.xml  |  5 +
 4 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/java/javax/el/Util.java b/java/javax/el/Util.java
index bb1601ee4d..8fdc2bb22f 100644
--- a/java/javax/el/Util.java
+++ b/java/javax/el/Util.java
@@ -544,11 +544,9 @@ class Util {
  */
 static Method getMethod(Class type, Object base, Method m) {
 JreCompat jreCompat = JreCompat.getInstance();
-// If base is null, method MUST be static
-// If base is non-null, method may be static or non-static
 if (m == null ||
 (Modifier.isPublic(type.getModifiers()) &&
-(jreCompat.canAccess(base, m) || base != null && 
jreCompat.canAccess(null, m {
+(Modifier.isStatic(m.getModifiers()) && 
jreCompat.canAccess(null, m) || jreCompat.canAccess(base, m {
 return m;
 }
 Class[] interfaces = type.getInterfaces();
diff --git a/java/org/apache/el/util/ReflectionUtil.java 
b/java/org/apache/el/util/ReflectionUtil.java
index c1162d1897..635c906123 100644
--- a/java/org/apache/el/util/ReflectionUtil.java
+++ b/java/org/apache/el/util/ReflectionUtil.java
@@ -430,11 +430,10 @@ public class ReflectionUtil {
  */
 private static Method getMethod(Class type, Object base, Method m) {
 JreCompat jreCompat = JreCompat.getInstance();
-// If base is null, method MUST be static
-// If base is non-null, method may be static or non-static
 if (m == null ||
 (Modifier.isPublic(type.getModifiers()) &&
-(jreCompat.canAccess(base, m) || base != null && 
jreCompat.canAccess(null, m {
+(Modifier.isStatic(m.getModifiers()) && 
jreCompat.canAccess(null, m)
+|| jreCompat.canAccess(base, m {
 return m;
 }
 Class[] interfaces = type.getInterfaces();
diff --git a/test/org/apache/el/util/TestReflectionUtil.java 
b/test/org/apache/el/util/TestReflectionUtil.java
index f39ae85467..ffac25b3bd 100644
--- a/test/org/apache/el/util/TestReflectionUtil.java
+++ b/test/org/apache/el/util/TestReflectionUtil.java
@@ -16,10 +16,16 @@
  */
 package org.apache.el.util;
 
+import javax.el.ELContext;
+import javax.el.ExpressionFactory;
+import javax.el.MethodExpression;
 import javax.el.MethodNotFoundException;
 
+import org.junit.Assert;
 import org.junit.Test;
 
+import org.apache.jasper.el.ELContextImpl;
+
 public class TestReflectionUtil {
 
 private static final Tester BASE = new Tester();
@@ -60,4 +66,23 @@ public class TestReflectionUtil {
 new Class[] {null},
 new Object[] {null});
 }
+
+@Test
+public void testStaticMethodOnInstance() {
+ExpressionFactory factory = ExpressionFactory.newInstance();
+ELContext context = new ELContextImpl(factory);
+
+MethodExpression methodExpression =
+factory.createMethodExpression(context, "${\"1\".format(2)}", 
String.class, new Class[] {});
+
+try {
+methodExpression.invoke(context, null);
+} catch (IllegalArgumentException iae) {
+// Ensure correct IllegalArgumentException is thrown
+String msg = iae.getMessage();
+Assert.assertTrue(msg, msg.contains("[format]"));
+return;
+}
+Assert.fail("No exception");
+}
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 9322c11152..eb0f1efd52 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -242,6 +242,11 @@
   
 66246: Fix JspC generates invalid web.xml due to incorrect 
header. (lihan)
   
+  
+Fix a bug in MethodExpression handling that triggered an
+error when invoking a static method on an instance of the class rather
+than directly on the class. (markt)
+  
 
   
   


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



[tomcat] branch 10.0.x updated: Fix MethodExpression when accessing static method via an instance

2022-08-31 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new 625c1785e8 Fix MethodExpression when accessing static method via an 
instance
625c1785e8 is described below

commit 625c1785e85c787d05e4e146d29d507abc38fe89
Author: Mark Thomas 
AuthorDate: Wed Aug 31 16:33:49 2022 +0100

Fix MethodExpression when accessing static method via an instance
---
 java/jakarta/el/Util.java   |  4 +---
 java/org/apache/el/util/ReflectionUtil.java |  5 ++---
 test/org/apache/el/util/TestReflectionUtil.java | 24 
 webapps/docs/changelog.xml  |  5 +
 4 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/java/jakarta/el/Util.java b/java/jakarta/el/Util.java
index 826f0ca447..1169d725b7 100644
--- a/java/jakarta/el/Util.java
+++ b/java/jakarta/el/Util.java
@@ -544,11 +544,9 @@ class Util {
  */
 static Method getMethod(Class type, Object base, Method m) {
 JreCompat jreCompat = JreCompat.getInstance();
-// If base is null, method MUST be static
-// If base is non-null, method may be static or non-static
 if (m == null ||
 (Modifier.isPublic(type.getModifiers()) &&
-(jreCompat.canAccess(base, m) || base != null && 
jreCompat.canAccess(null, m {
+(Modifier.isStatic(m.getModifiers()) && 
jreCompat.canAccess(null, m) || jreCompat.canAccess(base, m {
 return m;
 }
 Class[] interfaces = type.getInterfaces();
diff --git a/java/org/apache/el/util/ReflectionUtil.java 
b/java/org/apache/el/util/ReflectionUtil.java
index da32349240..a2ac01e5dd 100644
--- a/java/org/apache/el/util/ReflectionUtil.java
+++ b/java/org/apache/el/util/ReflectionUtil.java
@@ -430,11 +430,10 @@ public class ReflectionUtil {
  */
 private static Method getMethod(Class type, Object base, Method m) {
 JreCompat jreCompat = JreCompat.getInstance();
-// If base is null, method MUST be static
-// If base is non-null, method may be static or non-static
 if (m == null ||
 (Modifier.isPublic(type.getModifiers()) &&
-(jreCompat.canAccess(base, m) || base != null && 
jreCompat.canAccess(null, m {
+(Modifier.isStatic(m.getModifiers()) && 
jreCompat.canAccess(null, m)
+|| jreCompat.canAccess(base, m {
 return m;
 }
 Class[] interfaces = type.getInterfaces();
diff --git a/test/org/apache/el/util/TestReflectionUtil.java 
b/test/org/apache/el/util/TestReflectionUtil.java
index 43b519fbc6..4362fc255e 100644
--- a/test/org/apache/el/util/TestReflectionUtil.java
+++ b/test/org/apache/el/util/TestReflectionUtil.java
@@ -16,10 +16,16 @@
  */
 package org.apache.el.util;
 
+import jakarta.el.ELContext;
+import jakarta.el.ExpressionFactory;
+import jakarta.el.MethodExpression;
 import jakarta.el.MethodNotFoundException;
 
+import org.junit.Assert;
 import org.junit.Test;
 
+import org.apache.jasper.el.ELContextImpl;
+
 public class TestReflectionUtil {
 
 private static final Tester BASE = new Tester();
@@ -60,4 +66,22 @@ public class TestReflectionUtil {
 new Class[] {null},
 new Object[] {null});
 }
+
+@Test
+public void testStaticMethodOnInstance() {
+ExpressionFactory factory = ExpressionFactory.newInstance();
+ELContext context = new ELContextImpl(factory);
+
+MethodExpression methodExpression = 
factory.createMethodExpression(context, "${\"1\".format(2)}", String.class, new 
Class[] {});
+
+try {
+methodExpression.invoke(context, null);
+} catch (IllegalArgumentException iae) {
+// Ensure correct IllegalArgumentException is thrown
+String msg = iae.getMessage();
+Assert.assertTrue(msg, msg.contains("[format]"));
+return;
+}
+Assert.fail("No exception");
+}
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 91c138ebe9..60fba6ef8d 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -239,6 +239,11 @@
 type conversion fails during an EL arithmetic operation. This is an EL
 error so ELException seems more appropriate. (markt)
   
+  
+Fix a bug in MethodExpression handling that triggered an
+error when invoking a static method on an instance of the class rather
+than directly on the class. (markt)
+  
 
   
   


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



[tomcat] branch main updated: Fix MethodExpression when accessing static method via an instance

2022-08-31 Thread markt
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 786b43d522 Fix MethodExpression when accessing static method via an 
instance
786b43d522 is described below

commit 786b43d52229b8db14b343ac6022368fc01785ac
Author: Mark Thomas 
AuthorDate: Wed Aug 31 16:33:49 2022 +0100

Fix MethodExpression when accessing static method via an instance
---
 java/jakarta/el/Util.java   |  4 +---
 java/org/apache/el/util/ReflectionUtil.java |  4 +---
 test/org/apache/el/util/TestReflectionUtil.java | 24 
 webapps/docs/changelog.xml  |  5 +
 4 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/java/jakarta/el/Util.java b/java/jakarta/el/Util.java
index badccfb892..b0a995c59b 100644
--- a/java/jakarta/el/Util.java
+++ b/java/jakarta/el/Util.java
@@ -544,11 +544,9 @@ class Util {
  * making changes keep the code in sync.
  */
 static Method getMethod(Class type, Object base, Method m) {
-// If base is null, method MUST be static
-// If base is non-null, method may be static or non-static
 if (m == null ||
 (Modifier.isPublic(type.getModifiers()) &&
-(canAccess(base, m) || base != null && canAccess(null, 
m {
+(Modifier.isStatic(m.getModifiers()) && 
canAccess(null, m) || canAccess(base, m {
 return m;
 }
 Class[] interfaces = type.getInterfaces();
diff --git a/java/org/apache/el/util/ReflectionUtil.java 
b/java/org/apache/el/util/ReflectionUtil.java
index 70e7e41056..fd6680dd8f 100644
--- a/java/org/apache/el/util/ReflectionUtil.java
+++ b/java/org/apache/el/util/ReflectionUtil.java
@@ -429,11 +429,9 @@ public class ReflectionUtil {
  * the code in sync.
  */
 private static Method getMethod(Class type, Object base, Method m) {
-// If base is null, method MUST be static
-// If base is non-null, method may be static or non-static
 if (m == null ||
 (Modifier.isPublic(type.getModifiers()) &&
-(m.canAccess(base) || base != null && 
m.canAccess(null {
+(Modifier.isStatic(m.getModifiers()) && 
m.canAccess(null) || m.canAccess(base {
 return m;
 }
 Class[] interfaces = type.getInterfaces();
diff --git a/test/org/apache/el/util/TestReflectionUtil.java 
b/test/org/apache/el/util/TestReflectionUtil.java
index 43b519fbc6..4362fc255e 100644
--- a/test/org/apache/el/util/TestReflectionUtil.java
+++ b/test/org/apache/el/util/TestReflectionUtil.java
@@ -16,10 +16,16 @@
  */
 package org.apache.el.util;
 
+import jakarta.el.ELContext;
+import jakarta.el.ExpressionFactory;
+import jakarta.el.MethodExpression;
 import jakarta.el.MethodNotFoundException;
 
+import org.junit.Assert;
 import org.junit.Test;
 
+import org.apache.jasper.el.ELContextImpl;
+
 public class TestReflectionUtil {
 
 private static final Tester BASE = new Tester();
@@ -60,4 +66,22 @@ public class TestReflectionUtil {
 new Class[] {null},
 new Object[] {null});
 }
+
+@Test
+public void testStaticMethodOnInstance() {
+ExpressionFactory factory = ExpressionFactory.newInstance();
+ELContext context = new ELContextImpl(factory);
+
+MethodExpression methodExpression = 
factory.createMethodExpression(context, "${\"1\".format(2)}", String.class, new 
Class[] {});
+
+try {
+methodExpression.invoke(context, null);
+} catch (IllegalArgumentException iae) {
+// Ensure correct IllegalArgumentException is thrown
+String msg = iae.getMessage();
+Assert.assertTrue(msg, msg.contains("[format]"));
+return;
+}
+Assert.fail("No exception");
+}
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 6d053ef776..e43b8f5c60 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -239,6 +239,11 @@
 type conversion fails during an EL arithmetic operation. This is an EL
 error so ELException seems more appropriate. (markt)
   
+  
+Fix a bug in MethodExpression handling that triggered an
+error when invoking a static method on an instance of the class rather
+than directly on the class. (markt)
+  
 
   
   


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



[tomcat] branch 8.5.x updated: Update required for new test

2022-08-31 Thread markt
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 486c09eb52 Update required for new test
486c09eb52 is described below

commit 486c09eb52aa3aff49bfe577bfdaad2938e9f037
Author: Mark Thomas 
AuthorDate: Wed Aug 31 14:40:00 2022 +0100

Update required for new test
---
 build.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/build.xml b/build.xml
index 3291920a06..031585cc35 100644
--- a/build.xml
+++ b/build.xml
@@ -1449,6 +1449,7 @@
 
 
 
+
   
 
   


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



[tomcat] branch 9.0.x updated: Update required for new test

2022-08-31 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 6937a56307 Update required for new test
6937a56307 is described below

commit 6937a563073649060339f479595b77217957a28b
Author: Mark Thomas 
AuthorDate: Wed Aug 31 14:40:00 2022 +0100

Update required for new test
---
 build.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/build.xml b/build.xml
index bfe0309ce3..215223b61c 100644
--- a/build.xml
+++ b/build.xml
@@ -1821,6 +1821,7 @@
 
 
 
+
   
 
   


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



[tomcat] branch 10.0.x updated: Update required for new test

2022-08-31 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new 25f5b1843f Update required for new test
25f5b1843f is described below

commit 25f5b1843fc0af9f8116579923a6385f5e94525d
Author: Mark Thomas 
AuthorDate: Wed Aug 31 14:40:00 2022 +0100

Update required for new test
---
 build.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/build.xml b/build.xml
index b92b46517c..8cacba4e9f 100644
--- a/build.xml
+++ b/build.xml
@@ -1839,6 +1839,7 @@
 
 
 
+
   
 
   


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



[tomcat] branch main updated: Update required for new test

2022-08-31 Thread markt
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 de9ecdc520 Update required for new test
de9ecdc520 is described below

commit de9ecdc520de6091b0995f124920e9be64573399
Author: Mark Thomas 
AuthorDate: Wed Aug 31 14:40:00 2022 +0100

Update required for new test
---
 build.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/build.xml b/build.xml
index 5c6b6e07a8..affa108a9a 100644
--- a/build.xml
+++ b/build.xml
@@ -1864,6 +1864,7 @@
 
 
 
+
   
 
   


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



[tomcat] branch 8.5.x updated: Improve MessageFactory number formatting fixed after kkolinko's review

2022-08-31 Thread markt
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 1201f0f47a Improve MessageFactory number formatting fixed after 
kkolinko's review
1201f0f47a is described below

commit 1201f0f47a538307701cc74ecb6a293f7de66686
Author: Mark Thomas 
AuthorDate: Wed Aug 31 14:34:52 2022 +0100

Improve MessageFactory number formatting fixed after kkolinko's review

Refactored MessageFactory so it could be tested.
---
 java/org/apache/el/util/MessageFactory.java | 43 +---
 test/org/apache/el/util/TestMessageFactory.java | 44 +
 test/org/apache/el/util/TestStrings.properties  | 17 ++
 3 files changed, 93 insertions(+), 11 deletions(-)

diff --git a/java/org/apache/el/util/MessageFactory.java 
b/java/org/apache/el/util/MessageFactory.java
index 8061aa00ac..de20222e03 100644
--- a/java/org/apache/el/util/MessageFactory.java
+++ b/java/org/apache/el/util/MessageFactory.java
@@ -16,7 +16,9 @@
  */
 package org.apache.el.util;
 
+import java.text.Format;
 import java.text.MessageFormat;
+import java.text.NumberFormat;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
@@ -25,14 +27,25 @@ import java.util.ResourceBundle;
  */
 public final class MessageFactory {
 
-static final ResourceBundle bundle =
-ResourceBundle.getBundle("org.apache.el.Messages");
+private static final ResourceBundle DEFAULT_BUNDLE = 
ResourceBundle.getBundle("org.apache.el.Messages");
 
-public MessageFactory() {
-super();
-}
+private static final MessageFactory DEFAULT_MESSAGE_FACTORY = new 
MessageFactory(DEFAULT_BUNDLE);
 
 public static String get(final String key) {
+return DEFAULT_MESSAGE_FACTORY.getInternal(key);
+}
+
+public static String get(final String key, final Object... args) {
+return DEFAULT_MESSAGE_FACTORY.getInternal(key, args);
+}
+
+private final ResourceBundle bundle;
+
+public MessageFactory(ResourceBundle bundle) {
+this.bundle = bundle;
+}
+
+protected String getInternal(final String key) {
 try {
 return bundle.getString(key);
 } catch (MissingResourceException e) {
@@ -40,20 +53,28 @@ public final class MessageFactory {
 }
 }
 
-public static String get(final String key, final Object... args) {
-String value = get(key);
+protected String getInternal(final String key, final Object... args) {
+String value = getInternal(key);
 
-// Convert all Number arguments to String else MessageFormat may try to
-// format them in unexpected ways.
+MessageFormat mf = new MessageFormat(value);
+Format[] formats = null;
+
+// Unless an argument has been explicitly configured to use a number
+// format, 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();
+if (formats == null) {
+formats = mf.getFormatsByArgumentIndex();
+}
+if (!(formats[i] instanceof NumberFormat)) {
+args[i] = args[i].toString();
+}
 }
 }
 }
 
-MessageFormat mf = new MessageFormat(value);
 return mf.format(args, new StringBuffer(), null).toString();
 }
 }
diff --git a/test/org/apache/el/util/TestMessageFactory.java 
b/test/org/apache/el/util/TestMessageFactory.java
new file mode 100644
index 00..106a04
--- /dev/null
+++ b/test/org/apache/el/util/TestMessageFactory.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.el.util;
+
+import java.math.BigDecimal;
+import java.util.ResourceBundle;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class 

[tomcat] branch 9.0.x updated: Improve MessageFactory number formatting fixed after kkolinko's review

2022-08-31 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new ae1c230fd8 Improve MessageFactory number formatting fixed after 
kkolinko's review
ae1c230fd8 is described below

commit ae1c230fd885986987c18a6922f1053b4bb350c0
Author: Mark Thomas 
AuthorDate: Wed Aug 31 14:34:52 2022 +0100

Improve MessageFactory number formatting fixed after kkolinko's review

Refactored MessageFactory so it could be tested.
---
 java/org/apache/el/util/MessageFactory.java | 43 +---
 test/org/apache/el/util/TestMessageFactory.java | 44 +
 test/org/apache/el/util/TestStrings.properties  | 17 ++
 3 files changed, 93 insertions(+), 11 deletions(-)

diff --git a/java/org/apache/el/util/MessageFactory.java 
b/java/org/apache/el/util/MessageFactory.java
index 8061aa00ac..de20222e03 100644
--- a/java/org/apache/el/util/MessageFactory.java
+++ b/java/org/apache/el/util/MessageFactory.java
@@ -16,7 +16,9 @@
  */
 package org.apache.el.util;
 
+import java.text.Format;
 import java.text.MessageFormat;
+import java.text.NumberFormat;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
@@ -25,14 +27,25 @@ import java.util.ResourceBundle;
  */
 public final class MessageFactory {
 
-static final ResourceBundle bundle =
-ResourceBundle.getBundle("org.apache.el.Messages");
+private static final ResourceBundle DEFAULT_BUNDLE = 
ResourceBundle.getBundle("org.apache.el.Messages");
 
-public MessageFactory() {
-super();
-}
+private static final MessageFactory DEFAULT_MESSAGE_FACTORY = new 
MessageFactory(DEFAULT_BUNDLE);
 
 public static String get(final String key) {
+return DEFAULT_MESSAGE_FACTORY.getInternal(key);
+}
+
+public static String get(final String key, final Object... args) {
+return DEFAULT_MESSAGE_FACTORY.getInternal(key, args);
+}
+
+private final ResourceBundle bundle;
+
+public MessageFactory(ResourceBundle bundle) {
+this.bundle = bundle;
+}
+
+protected String getInternal(final String key) {
 try {
 return bundle.getString(key);
 } catch (MissingResourceException e) {
@@ -40,20 +53,28 @@ public final class MessageFactory {
 }
 }
 
-public static String get(final String key, final Object... args) {
-String value = get(key);
+protected String getInternal(final String key, final Object... args) {
+String value = getInternal(key);
 
-// Convert all Number arguments to String else MessageFormat may try to
-// format them in unexpected ways.
+MessageFormat mf = new MessageFormat(value);
+Format[] formats = null;
+
+// Unless an argument has been explicitly configured to use a number
+// format, 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();
+if (formats == null) {
+formats = mf.getFormatsByArgumentIndex();
+}
+if (!(formats[i] instanceof NumberFormat)) {
+args[i] = args[i].toString();
+}
 }
 }
 }
 
-MessageFormat mf = new MessageFormat(value);
 return mf.format(args, new StringBuffer(), null).toString();
 }
 }
diff --git a/test/org/apache/el/util/TestMessageFactory.java 
b/test/org/apache/el/util/TestMessageFactory.java
new file mode 100644
index 00..106a04
--- /dev/null
+++ b/test/org/apache/el/util/TestMessageFactory.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.el.util;
+
+import java.math.BigDecimal;
+import java.util.ResourceBundle;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class 

[tomcat] branch 10.0.x updated: Improve MessageFactory number formatting fixed after kkolinko's review

2022-08-31 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new e83a5e68dd Improve MessageFactory number formatting fixed after 
kkolinko's review
e83a5e68dd is described below

commit e83a5e68ddca59a1c91c3eb71499b7c402879ead
Author: Mark Thomas 
AuthorDate: Wed Aug 31 14:34:52 2022 +0100

Improve MessageFactory number formatting fixed after kkolinko's review

Refactored MessageFactory so it could be tested.
---
 java/org/apache/el/util/MessageFactory.java | 43 +---
 test/org/apache/el/util/TestMessageFactory.java | 44 +
 test/org/apache/el/util/TestStrings.properties  | 17 ++
 3 files changed, 93 insertions(+), 11 deletions(-)

diff --git a/java/org/apache/el/util/MessageFactory.java 
b/java/org/apache/el/util/MessageFactory.java
index 8061aa00ac..de20222e03 100644
--- a/java/org/apache/el/util/MessageFactory.java
+++ b/java/org/apache/el/util/MessageFactory.java
@@ -16,7 +16,9 @@
  */
 package org.apache.el.util;
 
+import java.text.Format;
 import java.text.MessageFormat;
+import java.text.NumberFormat;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
@@ -25,14 +27,25 @@ import java.util.ResourceBundle;
  */
 public final class MessageFactory {
 
-static final ResourceBundle bundle =
-ResourceBundle.getBundle("org.apache.el.Messages");
+private static final ResourceBundle DEFAULT_BUNDLE = 
ResourceBundle.getBundle("org.apache.el.Messages");
 
-public MessageFactory() {
-super();
-}
+private static final MessageFactory DEFAULT_MESSAGE_FACTORY = new 
MessageFactory(DEFAULT_BUNDLE);
 
 public static String get(final String key) {
+return DEFAULT_MESSAGE_FACTORY.getInternal(key);
+}
+
+public static String get(final String key, final Object... args) {
+return DEFAULT_MESSAGE_FACTORY.getInternal(key, args);
+}
+
+private final ResourceBundle bundle;
+
+public MessageFactory(ResourceBundle bundle) {
+this.bundle = bundle;
+}
+
+protected String getInternal(final String key) {
 try {
 return bundle.getString(key);
 } catch (MissingResourceException e) {
@@ -40,20 +53,28 @@ public final class MessageFactory {
 }
 }
 
-public static String get(final String key, final Object... args) {
-String value = get(key);
+protected String getInternal(final String key, final Object... args) {
+String value = getInternal(key);
 
-// Convert all Number arguments to String else MessageFormat may try to
-// format them in unexpected ways.
+MessageFormat mf = new MessageFormat(value);
+Format[] formats = null;
+
+// Unless an argument has been explicitly configured to use a number
+// format, 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();
+if (formats == null) {
+formats = mf.getFormatsByArgumentIndex();
+}
+if (!(formats[i] instanceof NumberFormat)) {
+args[i] = args[i].toString();
+}
 }
 }
 }
 
-MessageFormat mf = new MessageFormat(value);
 return mf.format(args, new StringBuffer(), null).toString();
 }
 }
diff --git a/test/org/apache/el/util/TestMessageFactory.java 
b/test/org/apache/el/util/TestMessageFactory.java
new file mode 100644
index 00..106a04
--- /dev/null
+++ b/test/org/apache/el/util/TestMessageFactory.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.el.util;
+
+import java.math.BigDecimal;
+import java.util.ResourceBundle;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class 

[tomcat] branch main updated: Improve MessageFactory number formatting fixed after kkolinko's review

2022-08-31 Thread markt
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 de6151c75d Improve MessageFactory number formatting fixed after 
kkolinko's review
de6151c75d is described below

commit de6151c75defb060d08f7b584be0bdee2f8948bb
Author: Mark Thomas 
AuthorDate: Wed Aug 31 14:34:52 2022 +0100

Improve MessageFactory number formatting fixed after kkolinko's review

Refactored MessageFactory so it could be tested.
---
 java/org/apache/el/util/MessageFactory.java | 42 +--
 test/org/apache/el/util/TestMessageFactory.java | 44 +
 test/org/apache/el/util/TestStrings.properties  | 17 ++
 3 files changed, 93 insertions(+), 10 deletions(-)

diff --git a/java/org/apache/el/util/MessageFactory.java 
b/java/org/apache/el/util/MessageFactory.java
index 3ad6986711..e7b42d0898 100644
--- a/java/org/apache/el/util/MessageFactory.java
+++ b/java/org/apache/el/util/MessageFactory.java
@@ -16,7 +16,9 @@
  */
 package org.apache.el.util;
 
+import java.text.Format;
 import java.text.MessageFormat;
+import java.text.NumberFormat;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
@@ -25,13 +27,25 @@ import java.util.ResourceBundle;
  */
 public final class MessageFactory {
 
-static final ResourceBundle bundle = 
ResourceBundle.getBundle("org.apache.el.LocalStrings");
+private static final ResourceBundle DEFAULT_BUNDLE = 
ResourceBundle.getBundle("org.apache.el.LocalStrings");
 
-public MessageFactory() {
-super();
-}
+private static final MessageFactory DEFAULT_MESSAGE_FACTORY = new 
MessageFactory(DEFAULT_BUNDLE);
 
 public static String get(final String key) {
+return DEFAULT_MESSAGE_FACTORY.getInternal(key);
+}
+
+public static String get(final String key, final Object... args) {
+return DEFAULT_MESSAGE_FACTORY.getInternal(key, args);
+}
+
+private final ResourceBundle bundle;
+
+public MessageFactory(ResourceBundle bundle) {
+this.bundle = bundle;
+}
+
+protected String getInternal(final String key) {
 try {
 return bundle.getString(key);
 } catch (MissingResourceException e) {
@@ -39,20 +53,28 @@ public final class MessageFactory {
 }
 }
 
-public static String get(final String key, final Object... args) {
-String value = get(key);
+protected String getInternal(final String key, final Object... args) {
+String value = getInternal(key);
 
-// Convert all Number arguments to String else MessageFormat may try to
-// format them in unexpected ways.
+MessageFormat mf = new MessageFormat(value);
+Format[] formats = null;
+
+// Unless an argument has been explicitly configured to use a number
+// format, 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();
+if (formats == null) {
+formats = mf.getFormatsByArgumentIndex();
+}
+if (!(formats[i] instanceof NumberFormat)) {
+args[i] = args[i].toString();
+}
 }
 }
 }
 
-MessageFormat mf = new MessageFormat(value);
 return mf.format(args, new StringBuffer(), null).toString();
 }
 }
diff --git a/test/org/apache/el/util/TestMessageFactory.java 
b/test/org/apache/el/util/TestMessageFactory.java
new file mode 100644
index 00..106a04
--- /dev/null
+++ b/test/org/apache/el/util/TestMessageFactory.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.el.util;
+
+import java.math.BigDecimal;
+import java.util.ResourceBundle;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class 

Re: Question about the log variable in Filters

2022-08-31 Thread tianshuang
Well, actually the Filter class will only be loaded once by the common 
classloader, to ensure that the latest log configuration in the webapp is used, 
we have to remove the static modifier to ensure that the log instance is 
recreated with the new configuration (if the configuration changes).

Thanks,
tianshuang

> On Aug 31, 2022, at 18:52, Konstantin Kolinko  wrote:
> 
> ср, 31 авг. 2022 г. в 13:25, tianshuang :
>> 
>> Hi,
>> 
>> In this commit 
>> ,
>>  the static modifier was removed from the log variable in the Filters class, 
>> but I don't understand why it needs to be removed. As far as I know, when a 
>> class is loaded by different classLoader, each classLoader creates its own 
>> instance of static variable. So, is it necessary to remove the static 
>> modifier here?
>> 
>> commit url: 
>> https://github.com/apache/tomcat/commit/dd44360b2ce8e5e1b79c756723158944264f556e
> 
> See classloader hierarchy here:
> 
> https://tomcat.apache.org/tomcat-10.1-doc/class-loader-howto.html
> https://tomcat.apache.org/tomcat-8.5-doc/class-loader-howto.html
> 
> When Webapp classloader loads the Filter class, it does not "load the
> class" (i.e. does not read the bytes from a jar archive and does not
> produce a Class out of those bytes). It delegates the task to its
> parent in the classloader hierarchy. Thus, the Filter class is loaded
> by the Common classloader.
> 
> At the same time, the logging configuration for each web application
> may be different:
> A web application may provide its own copy of logging.properties file
> by placing it into its own WEB-INF/classes/ directory.
> 
> https://tomcat.apache.org/tomcat-8.5-doc/logging.html#Using_java.util.logging_(default)
> 
> Best regards,
> Konstantin Kolinko
> 
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
> 


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



Re: Question about the log variable in Filters

2022-08-31 Thread Konstantin Kolinko
ср, 31 авг. 2022 г. в 13:25, tianshuang :
>
> Hi,
>
> In this commit 
> ,
>  the static modifier was removed from the log variable in the Filters class, 
> but I don't understand why it needs to be removed. As far as I know, when a 
> class is loaded by different classLoader, each classLoader creates its own 
> instance of static variable. So, is it necessary to remove the static 
> modifier here?
>
> commit url: 
> https://github.com/apache/tomcat/commit/dd44360b2ce8e5e1b79c756723158944264f556e

See classloader hierarchy here:

https://tomcat.apache.org/tomcat-10.1-doc/class-loader-howto.html
https://tomcat.apache.org/tomcat-8.5-doc/class-loader-howto.html

When Webapp classloader loads the Filter class, it does not "load the
class" (i.e. does not read the bytes from a jar archive and does not
produce a Class out of those bytes). It delegates the task to its
parent in the classloader hierarchy. Thus, the Filter class is loaded
by the Common classloader.

At the same time, the logging configuration for each web application
may be different:
A web application may provide its own copy of logging.properties file
by placing it into its own WEB-INF/classes/ directory.

https://tomcat.apache.org/tomcat-8.5-doc/logging.html#Using_java.util.logging_(default)

Best regards,
Konstantin Kolinko

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



Question about the log variable in Filters

2022-08-31 Thread tianshuang
Hi,

In this commit 
,
 the static modifier was removed from the log variable in the Filters class, 
but I don't understand why it needs to be removed. As far as I know, when a 
class is loaded by different classLoader, each classLoader creates its own 
instance of static variable. So, is it necessary to remove the static modifier 
here?

commit url: 
https://github.com/apache/tomcat/commit/dd44360b2ce8e5e1b79c756723158944264f556e

Thanks,
tianshuang

[GitHub] [tomcat-jakartaee-migration] aooohan closed issue #25: java.lang.IllegalArgumentException: Unknown Entity bean class with eclipselink in tomcat 10

2022-08-31 Thread GitBox


aooohan closed issue #25: java.lang.IllegalArgumentException: Unknown Entity 
bean class with eclipselink in tomcat 10
URL: https://github.com/apache/tomcat-jakartaee-migration/issues/25


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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



[GitHub] [tomcat-jakartaee-migration] aooohan commented on issue #25: java.lang.IllegalArgumentException: Unknown Entity bean class with eclipselink in tomcat 10

2022-08-31 Thread GitBox


aooohan commented on issue #25:
URL: 
https://github.com/apache/tomcat-jakartaee-migration/issues/25#issuecomment-1232735173

   Close this issue first, then reopen it when you have provided a test case.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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



[tomcat] branch 9.0.x updated: Update the schema location of webxml,thanks to Mark

2022-08-31 Thread lihan
This is an automated email from the ASF dual-hosted git repository.

lihan pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 9b893fdc5d Update the schema location of webxml,thanks to Mark
9b893fdc5d is described below

commit 9b893fdc5db5541809664f8476e1b593245154ea
Author: lihan 
AuthorDate: Wed Aug 31 15:31:20 2022 +0800

Update the schema location of webxml,thanks to Mark
---
 java/org/apache/jasper/resources/LocalStrings.properties | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/jasper/resources/LocalStrings.properties 
b/java/org/apache/jasper/resources/LocalStrings.properties
index 6e4496378f..7cb588fc22 100644
--- a/java/org/apache/jasper/resources/LocalStrings.properties
+++ b/java/org/apache/jasper/resources/LocalStrings.properties
@@ -392,7 +392,7 @@ jspc.webxml.header=\n\
 http://xmlns.jcp.org/xml/ns/javaee"\n\
 \  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n\
 \  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee\n\
-\  
http://xmlns.jcp.org/xml/ns/javaee/web-fragment_4_0.xsd"\n\
+\  http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"\n\
 \  version="4.0"\n\
 \ metadata-complete="false">\n\
 

Re: [tomcat] branch main updated: Improve handling of EL error messages.

2022-08-31 Thread Mark Thomas

On 30/08/2022 13:21, Konstantin Kolinko wrote:

вт, 30 авг. 2022 г. в 10:13, Mark Thomas :


On 29/08/2022 14:06, Christopher Schultz wrote:

Mark,

On 8/29/22 02:39, ma...@apache.org wrote:





   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?


It is only for error messages and the like.

oss-fuzz found an edge case where MessageFormat would output a number
with hundreds of thousands of digits as an integer rather than using
exponential form.

Any such instances would be application bugs (the issue is in parsing
the EL expression so there is no way for users to trigger this). It
seems unlikely that this would occur in practice.


1. I think we are actually dealing with a JRE bug here.

As such, while only MessageFactory in EL was tested, in theory it
concerns other copies of this class.

2. Personally, as a programmer, I do like when numbers are printed in
a programmer-friendly way, i.e. via toString() like here, but
generally it means losing i18n.

3. For future reference
- Javadoc of MessageFormat. Java 17:

https://docs.oracle.com/javase/8/docs/api/java/text/MessageFormat.html

- messages used by EL code come from
static final ResourceBundle bundle =
ResourceBundle.getBundle("org.apache.el.LocalStrings");

and look like

error.convert=Cannot convert [{0}] of type [{1}] to [{2}]


4. I think that the JRE bug is as follows:

(1) The Javadoc of MessageFormat says (see a table there) that to
format a number you specify the format with FormatType = "number". The
FormatStyle may be omitted.

E.g. "{0, number}" can be used to clearly declare that the argument
has to be formatted as a Number.

(2) It says that for FormatType=none, it creates a Subformat of null.

Looking into the source code (OpenJDK 17.0.4)
parsing the format string is implemented in method #makeFormat(...).
See the branch with "case TYPE_NULL:" there.

It results in assigning the null value to an entry in "formats[]" array.

(3) I suspect that a null format was actually intended to serve as a
"text" format. My concerns:

- The MessageFormat lacks an explicit "text" FormatType.

In comparison, with a java.util.Formatter I can use an explicit %s
pattern to specify textual format.

- There is a comment in the source code of MessageFormat #toPattern():

[[[
 if (fmt == null) {
 // do nothing, string format
 } else if ...
]]]

- I do not see any documentation in MessageFormat javadoc on how the
null Subformat is supposed to be treated.

Nor I found it in the official tutorial.
https://docs.oracle.com/javase/tutorial/i18n/format/messageFormat.html

I guess the behaviour may be "specified" in a hidden way, via TCK.


(4) The actual implementation of formatting (implemented in
MessageFormat#subformat(...)) is different:

[[[
 } else if (formats[i] != null) {
 subFormatter = formats[i];
 if (subFormatter instanceof ChoiceFormat) {
 arg = formats[i].format(obj);
 if (arg.indexOf('{') >= 0) {
 subFormatter = new MessageFormat(arg, locale);
 obj = arguments;
 arg = null;
 }
}
 } else if (obj instanceof Number) {
 // format number if can
 subFormatter = NumberFormat.getInstance(locale);
 } else if (obj instanceof Date) {
 // format a Date if can
 subFormatter = DateFormat.getDateTimeInstance(
  DateFormat.SHORT, DateFormat.SHORT, locale);//fix
 } else if (obj instanceof String) {
 arg = (String) obj;
 } else {
 arg = obj.toString();
 if (arg == null) arg = "null";
 }
]]]

I.e. if format[i] is null it does not interpret it as "text", but
tries "to be smart" and does some processing for Numbers.

(5) According to oss-fuzz we now know that such processing is broken.
It assumes that any Number can be sanely formatted by a
"NumberFormat.getInstance(locale);".


5. What to do. I see the following ways for a better workaround of the JRE bug:

(a) It is possible to narrow Mark's patch:
narrowing the 

Re: [tomcat] branch 9.0.x updated: Fix BZ66246 https://bz.apache.org/bugzilla/show_bug.cgi?id=66246

2022-08-31 Thread Han Li



> 2022年8月31日 14:28,Mark Thomas  写道:
> 
> On 31/08/2022 02:57, li...@apache.org wrote:
>> This is an automated email from the ASF dual-hosted git repository.
>> lihan pushed a commit to branch 9.0.x
>> in repository https://gitbox.apache.org/repos/asf/tomcat.git
>> The following commit(s) were added to refs/heads/9.0.x by this push:
>>  new 971038192b Fix BZ66246 
>> https://bz.apache.org/bugzilla/show_bug.cgi?id=66246
>> 971038192b is described below
>> commit 971038192b1d747810de71e4dac8559d4c04d7a3
>> Author: lihan 
>> AuthorDate: Wed Aug 31 09:56:36 2022 +0800
>> Fix BZ66246
>> https://bz.apache.org/bugzilla/show_bug.cgi?id=66246
>> ---
>>  java/org/apache/jasper/resources/LocalStrings.properties | 2 +-
>>  webapps/docs/changelog.xml   | 3 +++
>>  2 files changed, 4 insertions(+), 1 deletion(-)
>> diff --git a/java/org/apache/jasper/resources/LocalStrings.properties 
>> b/java/org/apache/jasper/resources/LocalStrings.properties
>> index 4339d968da..6e4496378f 100644
>> --- a/java/org/apache/jasper/resources/LocalStrings.properties
>> +++ b/java/org/apache/jasper/resources/LocalStrings.properties
>> @@ -389,7 +389,7 @@ jspc.webxml.footer=\n\
>>  \n\
>>  \n
>>  jspc.webxml.header=\n\
>> -http://xmlns.jcp.org/xml/ns/javaee"\n\
>> +http://xmlns.jcp.org/xml/ns/javaee"\n\
>>  \  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n\
>>  \  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee\n\
>>  \  
>> http://xmlns.jcp.org/xml/ns/javaee/web-fragment_4_0.xsd"\n\
> 
> The schema location needs to be updated as well.

OK, I will update it later.

Han
> 
> Mark
> 
> 
>> diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
>> index 0831e26371..9322c11152 100644
>> --- a/webapps/docs/changelog.xml
>> +++ b/webapps/docs/changelog.xml
>> @@ -239,6 +239,9 @@
>>  type conversion fails during an EL arithmetic operation. This is an 
>> EL
>>  error so ELException seems more appropriate. (markt)
>>
>> +  
>> +66246: Fix JspC generates invalid web.xml due to 
>> incorrect header. (lihan)
>> +  
>>  
>>
>>
>> -
>> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: dev-h...@tomcat.apache.org
> 
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
> 


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



Re: [tomcat] branch 9.0.x updated: Fix BZ66246 https://bz.apache.org/bugzilla/show_bug.cgi?id=66246

2022-08-31 Thread Mark Thomas

On 31/08/2022 02:57, li...@apache.org wrote:

This is an automated email from the ASF dual-hosted git repository.

lihan pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
  new 971038192b Fix BZ66246 
https://bz.apache.org/bugzilla/show_bug.cgi?id=66246
971038192b is described below

commit 971038192b1d747810de71e4dac8559d4c04d7a3
Author: lihan 
AuthorDate: Wed Aug 31 09:56:36 2022 +0800

 Fix BZ66246
 https://bz.apache.org/bugzilla/show_bug.cgi?id=66246
---
  java/org/apache/jasper/resources/LocalStrings.properties | 2 +-
  webapps/docs/changelog.xml   | 3 +++
  2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/jasper/resources/LocalStrings.properties 
b/java/org/apache/jasper/resources/LocalStrings.properties
index 4339d968da..6e4496378f 100644
--- a/java/org/apache/jasper/resources/LocalStrings.properties
+++ b/java/org/apache/jasper/resources/LocalStrings.properties
@@ -389,7 +389,7 @@ jspc.webxml.footer=\n\
  \n\
  \n
  jspc.webxml.header=\n\
-http://xmlns.jcp.org/xml/ns/javaee"\n\
+http://xmlns.jcp.org/xml/ns/javaee"\n\
  \  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n\
  \  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee\n\
  \  
http://xmlns.jcp.org/xml/ns/javaee/web-fragment_4_0.xsd"\n\


The schema location needs to be updated as well.

Mark



diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 0831e26371..9322c11152 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -239,6 +239,9 @@
  type conversion fails during an EL arithmetic operation. This is an EL
  error so ELException seems more appropriate. (markt)

+  
+66246: Fix JspC generates invalid web.xml due to incorrect 
header. (lihan)
+  
  




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



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