This is an automated email from the ASF dual-hosted git repository.
markt-asf 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 e18bfd84fd Add test case for bug 70249
e18bfd84fd is described below
commit e18bfd84fdf404d8f9289fc9312fc110cef7670a
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Sep 28 13:29:58 2026 +0100
Add test case for bug 70249
---
test/org/apache/el/TestELInJsp.java | 12 +++++++
test/org/apache/el/lang/TestELSupport.java | 58 +++++++++++-------------------
test/webapp/bug7nnnn/bug70249.jsp | 19 ++++++++++
3 files changed, 52 insertions(+), 37 deletions(-)
diff --git a/test/org/apache/el/TestELInJsp.java
b/test/org/apache/el/TestELInJsp.java
index d1ccefa636..1d3ace2218 100644
--- a/test/org/apache/el/TestELInJsp.java
+++ b/test/org/apache/el/TestELInJsp.java
@@ -517,6 +517,18 @@ public class TestELInJsp extends TomcatBaseTest {
}
+ @Test
+ public void testBug70246() throws Exception {
+ getTomcatInstanceTestWebapp(true, true);
+
+ ByteChunk res = getUrl("http://localhost:" + getPort() +
"/test/bug7nnnn/bug70249.jsp");
+ String result = res.toString();
+ assertEcho(result, "01-[1, 2, 11]");
+ assertEcho(result, "02-[1, 2, 11]");
+ assertEcho(result, "03-[1, 11, 2]");
+ }
+
+
// Assertion for text contained with <p></p>, e.g. printed by tags:echo
private static void assertEcho(String result, String expected) {
Assert.assertTrue(result, result.indexOf("<p>" + expected + "</p>") >
0);
diff --git a/test/org/apache/el/lang/TestELSupport.java
b/test/org/apache/el/lang/TestELSupport.java
index f7f8a26bdf..528ed50379 100644
--- a/test/org/apache/el/lang/TestELSupport.java
+++ b/test/org/apache/el/lang/TestELSupport.java
@@ -34,14 +34,12 @@ public class TestELSupport {
@Test
public void testBigDecimal() {
- testIsSame(new BigDecimal(
-
"0.123456789012345678901234567890123456789012345678901234567890123456789"));
+ testIsSame(new
BigDecimal("0.123456789012345678901234567890123456789012345678901234567890123456789"));
}
@Test
public void testBigInteger() {
- testIsSame(new BigInteger(
-
"1234567890123456789012345678901234567890123456789012345678901234567890"));
+ testIsSame(new
BigInteger("1234567890123456789012345678901234567890123456789012345678901234567890"));
}
@Test
@@ -121,116 +119,100 @@ public class TestELSupport {
@Test
public void testCoerceToType01() {
- Object result = ELManager.getExpressionFactory().coerceToType(
- null, Integer.class);
+ Object result = ELManager.getExpressionFactory().coerceToType(null,
Integer.class);
Assert.assertNull("Result: " + result, result);
}
@Test
public void testCoerceToType02() {
- Object result = ELManager.getExpressionFactory().coerceToType(
- null, int.class);
+ Object result = ELManager.getExpressionFactory().coerceToType(null,
int.class);
Assert.assertEquals(Integer.valueOf(0), result);
}
@Test
public void testCoerceToType03() {
- Object result = ELManager.getExpressionFactory().coerceToType(
- null, boolean.class);
+ Object result = ELManager.getExpressionFactory().coerceToType(null,
boolean.class);
Assert.assertEquals(Boolean.valueOf(null), result);
}
@Test
public void testCoerceToType04() {
- Object result = ELManager.getExpressionFactory().coerceToType(
- null, String.class);
+ Object result = ELManager.getExpressionFactory().coerceToType(null,
String.class);
Assert.assertEquals("", result);
}
@Test
public void testCoerceToType05() {
- Object result = ELManager.getExpressionFactory().coerceToType(
- null, Character.class);
+ Object result = ELManager.getExpressionFactory().coerceToType(null,
Character.class);
Assert.assertNull("Result: " + result, result);
}
@Test
public void testCoerceToType06() {
- Object result = ELManager.getExpressionFactory().coerceToType(
- "", Character.class);
+ Object result = ELManager.getExpressionFactory().coerceToType("",
Character.class);
Assert.assertEquals(Character.valueOf((char) 0), result);
}
@Test
public void testCoerceToType07() {
- Object result = ELManager.getExpressionFactory().coerceToType(
- null, char.class);
+ Object result = ELManager.getExpressionFactory().coerceToType(null,
char.class);
Assert.assertEquals(Character.valueOf((char) 0), result);
}
@Test
public void testCoerceToType08() {
- Object result = ELManager.getExpressionFactory().coerceToType(
- "", char.class);
+ Object result = ELManager.getExpressionFactory().coerceToType("",
char.class);
Assert.assertEquals(Character.valueOf((char) 0), result);
}
@Test
public void testCoerceToType09() {
- Object result = ELManager.getExpressionFactory().coerceToType(
- null, Boolean.class);
+ Object result = ELManager.getExpressionFactory().coerceToType(null,
Boolean.class);
Assert.assertNull("Result: " + result, result);
}
@Test
public void testCoerceToType10() {
- Object result = ELManager.getExpressionFactory().coerceToType(
- "", Boolean.class);
+ Object result = ELManager.getExpressionFactory().coerceToType("",
Boolean.class);
Assert.assertEquals(Boolean.FALSE, result);
}
@Test
public void testCoerceToType11() {
- Object result = ELManager.getExpressionFactory().coerceToType(
- null, boolean.class);
+ Object result = ELManager.getExpressionFactory().coerceToType(null,
boolean.class);
Assert.assertEquals(Boolean.FALSE, result);
}
@Test
public void testCoerceToType12() {
- Object result = ELManager.getExpressionFactory().coerceToType(
- "", boolean.class);
+ Object result = ELManager.getExpressionFactory().coerceToType("",
boolean.class);
Assert.assertEquals(Boolean.FALSE, result);
}
@Test
public void testCoerceToType13() {
- Object result = ELManager.getExpressionFactory().coerceToType(
- "", TesterType.class);
+ Object result = ELManager.getExpressionFactory().coerceToType("",
TesterType.class);
Assert.assertNull(result);
}
@Test
public void testCoerceToType14() {
PropertyEditorManager.registerEditor(TesterType.class,
TesterTypeEditorNoError.class);
- Object result = ELManager.getExpressionFactory().coerceToType(
- "Foo", TesterType.class);
+ Object result = ELManager.getExpressionFactory().coerceToType("Foo",
TesterType.class);
Assert.assertEquals("Foo", ((TesterType) result).getValue());
}
- @Test(expected=ELException.class)
+ @Test(expected = ELException.class)
public void testCoerceToType15() {
PropertyEditorManager.registerEditor(TesterType.class,
TesterTypeEditorError.class);
- Object result = ELManager.getExpressionFactory().coerceToType(
- "Foo", TesterType.class);
+ Object result = ELManager.getExpressionFactory().coerceToType("Foo",
TesterType.class);
Assert.assertEquals("Foo", ((TesterType) result).getValue());
}
@Test
public void testCoerceToType16() {
PropertyEditorManager.registerEditor(TesterType.class,
TesterTypeEditorError.class);
- Object result = ELManager.getExpressionFactory().coerceToType(
- "", TesterType.class);
+ Object result = ELManager.getExpressionFactory().coerceToType("",
TesterType.class);
Assert.assertNull(result);
}
@@ -266,10 +248,12 @@ public class TestELSupport {
VALA1,
VALA2
}
+
private enum TestEnumB {
VALB1,
VALB2
}
+
private enum TestEnumC {
VALA1,
VALA2,
diff --git a/test/webapp/bug7nnnn/bug70249.jsp
b/test/webapp/bug7nnnn/bug70249.jsp
new file mode 100644
index 0000000000..992b2f5777
--- /dev/null
+++ b/test/webapp/bug7nnnn/bug70249.jsp
@@ -0,0 +1,19 @@
+<%--
+ 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.
+--%>
+<p>01-${ ["11", "2", "1"].stream().sorted( (a,b) ->
Long.valueOf(a).compareTo(Long.valueOf(b))).toList() }</p>
+<p>02-${ ["11", "2", "1"].stream().sorted( (a,b) -> Integer.parseInt(a) -
Integer.parseInt(b)).toList() }</p>
+<p>03-${ ["11", "2", "1"].stream().sorted( (a,b) -> a.compareTo(b)).toList()
}</p>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]