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
commit 25a76b580c68e239ac7b3eb0a14478f1b061c36d Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed Feb 22 19:44:35 2023 +0000 Clean-up. Reformatting. No functional change. --- test/org/apache/el/TestELEvaluation.java | 40 ++-- test/org/apache/el/TestELInJsp.java | 58 ++---- test/org/apache/el/TestMethodExpressionImpl.java | 255 ++++++++++------------- test/org/apache/el/TestValueExpressionImpl.java | 68 ++---- test/org/apache/el/TesterBeanB.java | 2 +- test/org/apache/el/TesterBeanC.java | 6 +- test/org/apache/el/TesterBeanF.java | 8 +- test/org/apache/el/TesterBeanG.java | 7 +- test/org/apache/el/TesterBeanH.java | 5 +- test/org/apache/el/TesterEnum.java | 3 +- test/org/apache/el/TesterFunctions.java | 1 + 11 files changed, 185 insertions(+), 268 deletions(-) diff --git a/test/org/apache/el/TestELEvaluation.java b/test/org/apache/el/TestELEvaluation.java index 73e03e2207..6646c3a9b8 100644 --- a/test/org/apache/el/TestELEvaluation.java +++ b/test/org/apache/el/TestELEvaluation.java @@ -29,15 +29,13 @@ import org.apache.el.lang.ELSupport; import org.apache.jasper.el.ELContextImpl; /** - * Tests the EL engine directly. Similar tests may be found in - * {@link org.apache.jasper.compiler.TestAttributeParser} and - * {@link TestELInJsp}. + * Tests the EL engine directly. Similar tests may be found in {@link org.apache.jasper.compiler.TestAttributeParser} + * and {@link TestELInJsp}. */ public class TestELEvaluation { /** - * Test use of spaces in ternary expressions. This was primarily an EL - * parser bug. + * Test use of spaces in ternary expressions. This was primarily an EL parser bug. */ @Test public void testBug42565() { @@ -65,12 +63,9 @@ public class TestELEvaluation { */ @Test public void testBug44994() { - Assert.assertEquals("none", evaluateExpression( - "${0 lt 0 ? 1 lt 0 ? 'many': 'one': 'none'}")); - Assert.assertEquals("one", evaluateExpression( - "${0 lt 1 ? 1 lt 1 ? 'many': 'one': 'none'}")); - Assert.assertEquals("many", evaluateExpression( - "${0 lt 2 ? 1 lt 2 ? 'many': 'one': 'none'}")); + Assert.assertEquals("none", evaluateExpression("${0 lt 0 ? 1 lt 0 ? 'many': 'one': 'none'}")); + Assert.assertEquals("one", evaluateExpression("${0 lt 1 ? 1 lt 1 ? 'many': 'one': 'none'}")); + Assert.assertEquals("many", evaluateExpression("${0 lt 2 ? 1 lt 2 ? 'many': 'one': 'none'}")); } @Test @@ -97,8 +92,8 @@ public class TestELEvaluation { Assert.assertEquals("\\\\", evaluateExpression("\\\\")); /* - * LiteralExpressions can only contain ${ or #{ if escaped with \ - * \ is not an escape character in any other circumstances including \\ + * LiteralExpressions can only contain ${ or #{ if escaped with \ \ is not an escape character in any other + * circumstances including \\ */ Assert.assertEquals("\\", evaluateExpression("\\")); Assert.assertEquals("$", evaluateExpression("$")); @@ -162,22 +157,22 @@ public class TestELEvaluation { Assert.assertEquals("''", evaluateExpression("${\"\'\'\"}")); } - private void compareBoth(String msg, int expected, Object o1, Object o2){ + private void compareBoth(String msg, int expected, Object o1, Object o2) { int i1 = ELSupport.compare(null, o1, o2); int i2 = ELSupport.compare(null, o2, o1); - Assert.assertEquals(msg,expected, i1); - Assert.assertEquals(msg,expected, -i2); + Assert.assertEquals(msg, expected, i1); + Assert.assertEquals(msg, expected, -i2); } @Test - public void testElSupportCompare(){ + public void testElSupportCompare() { compareBoth("Nulls should compare equal", 0, null, null); compareBoth("Null should compare equal to \"\"", 0, "", null); - compareBoth("Null should be less than File()",-1, null, new File("")); - compareBoth("Null should be less than Date()",-1, null, new Date()); - compareBoth("Date(0) should be less than Date(1)",-1, new Date(0), new Date(1)); + compareBoth("Null should be less than File()", -1, null, new File("")); + compareBoth("Null should be less than Date()", -1, null, new Date()); + compareBoth("Date(0) should be less than Date(1)", -1, new Date(0), new Date(1)); try { - compareBoth("Should not compare",0, new Date(), new File("")); + compareBoth("Should not compare", 0, new Date(), new File("")); Assert.fail("Expecting ClassCastException"); } catch (ClassCastException expected) { // Expected @@ -256,8 +251,7 @@ public class TestELEvaluation { ExpressionFactoryImpl exprFactory = new ExpressionFactoryImpl(); ELContextImpl ctx = new ELContextImpl(exprFactory); ctx.setFunctionMapper(new TesterFunctions.FMapper()); - ValueExpression ve = exprFactory.createValueExpression(ctx, expression, - String.class); + ValueExpression ve = exprFactory.createValueExpression(ctx, expression, String.class); return (String) ve.getValue(ctx); } } diff --git a/test/org/apache/el/TestELInJsp.java b/test/org/apache/el/TestELInJsp.java index 66c0f3d7e3..e36f939af5 100644 --- a/test/org/apache/el/TestELInJsp.java +++ b/test/org/apache/el/TestELInJsp.java @@ -33,9 +33,8 @@ import org.apache.jasper.servlet.JasperInitializer; import org.apache.tomcat.util.buf.ByteChunk; /** - * Tests EL with an without JSP attributes using a test web application. Similar - * tests may be found in {@link TestELEvaluation} and - * {@link org.apache.jasper.compiler.TestAttributeParser}. + * Tests EL with an without JSP attributes using a test web application. Similar tests may be found in + * {@link TestELEvaluation} and {@link org.apache.jasper.compiler.TestAttributeParser}. */ public class TestELInJsp extends TomcatBaseTest { @@ -90,8 +89,7 @@ public class TestELInJsp extends TomcatBaseTest { public void testBug45427() throws Exception { getTomcatInstanceTestWebapp(false, true); - ByteChunk res = getUrl("http://localhost:" + getPort() + - "/test/bug45nnn/bug45427.jsp"); + ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug45nnn/bug45427.jsp"); String result = res.toString(); // Warning: JSP attribute escaping != Java String escaping @@ -117,8 +115,7 @@ public class TestELInJsp extends TomcatBaseTest { public void testBug45451() throws Exception { getTomcatInstanceTestWebapp(false, true); - ByteChunk res = getUrl("http://localhost:" + getPort() + - "/test/bug45nnn/bug45451a.jsp"); + ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug45nnn/bug45451a.jsp"); String result = res.toString(); // Warning: JSP attribute escaping != Java String escaping @@ -131,7 +128,7 @@ public class TestELInJsp extends TomcatBaseTest { result = res.toString(); // Warning: JSP attribute escaping != Java String escaping // Warning: Attributes are always unescaped before passing to the EL - // processor + // processor assertEcho(result, "00-2"); assertEcho(result, "01-${1+1}"); assertEcho(result, "02-\\${1+1}"); @@ -160,7 +157,7 @@ public class TestELInJsp extends TomcatBaseTest { result = res.toString(); // Warning: JSP attribute escaping != Java String escaping // TODO - Currently we allow a single unescaped \ in attribute values - // Review if this should cause a warning/error + // Review if this should cause a warning/error assertEcho(result, "00-${1+1}"); assertEcho(result, "01-\\${1+1}"); assertEcho(result, "02-\\\\${1+1}"); @@ -203,7 +200,7 @@ public class TestELInJsp extends TomcatBaseTest { result = res.toString(); // Warning: JSP attribute escaping != Java String escaping // Warning: Attributes are always unescaped before passing to the EL - // processor + // processor assertEcho(result, "00-2"); assertEcho(result, "01-${1+1}"); assertEcho(result, "02-\\${1+1}"); @@ -226,8 +223,7 @@ public class TestELInJsp extends TomcatBaseTest { public void testBug45511() throws Exception { getTomcatInstanceTestWebapp(false, true); - ByteChunk res = getUrl("http://localhost:" + getPort() + - "/test/bug45nnn/bug45511.jsp"); + ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug45nnn/bug45511.jsp"); String result = res.toString(); assertEcho(result, "00-true"); @@ -268,8 +264,7 @@ public class TestELInJsp extends TomcatBaseTest { public void testBug48112() throws Exception { getTomcatInstanceTestWebapp(false, true); - ByteChunk res = getUrl("http://localhost:" + getPort() + - "/test/bug48nnn/bug48112.jsp"); + ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug48nnn/bug48112.jsp"); String result = res.toString(); assertEcho(result, "{OK}"); } @@ -288,8 +283,7 @@ public class TestELInJsp extends TomcatBaseTest { public void testBug51544() throws Exception { getTomcatInstanceTestWebapp(false, true); - ByteChunk res = getUrl("http://localhost:" + getPort() + - "/test/bug5nnnn/bug51544.jsp"); + ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug5nnnn/bug51544.jsp"); String result = res.toString(); assertEcho(result, "Empty list: true"); @@ -311,8 +305,7 @@ public class TestELInJsp extends TomcatBaseTest { // Create the context (don't use addWebapp as we want to modify the // JSP Servlet settings). File appDir = new File("test/webapp"); - StandardContext ctxt = (StandardContext) tomcat.addContext( - null, "/test", appDir.getAbsolutePath()); + StandardContext ctxt = (StandardContext) tomcat.addContext(null, "/test", appDir.getAbsolutePath()); ctxt.addServletContainerInitializer(new JasperInitializer(), null); @@ -398,8 +391,7 @@ public class TestELInJsp extends TomcatBaseTest { public void testBug56029() throws Exception { getTomcatInstanceTestWebapp(true, true); - ByteChunk res = getUrl("http://localhost:" + getPort() + - "/test/bug5nnnn/bug56029.jspx"); + ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug5nnnn/bug56029.jspx"); String result = res.toString(); @@ -411,8 +403,7 @@ public class TestELInJsp extends TomcatBaseTest { public void testBug56147() throws Exception { getTomcatInstanceTestWebapp(true, true); - ByteChunk res = getUrl("http://localhost:" + getPort() + - "/test/bug5nnnn/bug56147.jsp"); + ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug5nnnn/bug56147.jsp"); String result = res.toString(); assertEcho(result, "00-OK"); @@ -423,8 +414,7 @@ public class TestELInJsp extends TomcatBaseTest { public void testBug56612() throws Exception { getTomcatInstanceTestWebapp(false, true); - ByteChunk res = getUrl("http://localhost:" + getPort() + - "/test/bug5nnnn/bug56612.jsp"); + ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug5nnnn/bug56612.jsp"); String result = res.toString(); Assert.assertTrue(result.contains("00-''")); @@ -438,8 +428,7 @@ public class TestELInJsp extends TomcatBaseTest { public void testBug57141() throws Exception { getTomcatInstanceTestWebapp(false, true); - ByteChunk res = getUrl("http://localhost:" + getPort() + - "/test/bug5nnnn/bug57141.jsp"); + ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug5nnnn/bug57141.jsp"); String result = res.toString(); assertEcho(result, "00-true"); @@ -449,16 +438,14 @@ public class TestELInJsp extends TomcatBaseTest { /* - * BZ https://bz.apache.org/bugzilla/show_bug.cgi?id=57142 - * javax.servlet, javax.servlet.http and javax.servlet.jsp should be - * imported by default. + * BZ https://bz.apache.org/bugzilla/show_bug.cgi?id=57142 javax.servlet, javax.servlet.http and javax.servlet.jsp + * should be imported by default. */ @Test public void testBug57142() throws Exception { getTomcatInstanceTestWebapp(false, true); - ByteChunk res = getUrl("http://localhost:" + getPort() + - "/test/bug5nnnn/bug57142.jsp"); + ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug5nnnn/bug57142.jsp"); String result = res.toString(); // javax.servlet @@ -474,15 +461,14 @@ public class TestELInJsp extends TomcatBaseTest { /* - * BZ https://bz.apache.org/bugzilla/show_bug.cgi?id=57441 - * Can't validate function names defined in lambdas (or via imports) + * BZ https://bz.apache.org/bugzilla/show_bug.cgi?id=57441 Can't validate function names defined in lambdas (or via + * imports) */ @Test public void testBug57441() throws Exception { getTomcatInstanceTestWebapp(false, true); - ByteChunk res = getUrl("http://localhost:" + getPort() + - "/test/bug5nnnn/bug57441.jsp"); + ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug5nnnn/bug57441.jsp"); String result = res.toString(); assertEcho(result, "00-11"); @@ -513,7 +499,7 @@ public class TestELInJsp extends TomcatBaseTest { @Test public void testBug61854a() throws Exception { - getTomcatInstanceTestWebapp(true, true); + getTomcatInstanceTestWebapp(true, true); ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug6nnnn/bug61854.jsp"); String result = res.toString(); diff --git a/test/org/apache/el/TestMethodExpressionImpl.java b/test/org/apache/el/TestMethodExpressionImpl.java index 3b6ec391fb..21443c5bf4 100644 --- a/test/org/apache/el/TestMethodExpressionImpl.java +++ b/test/org/apache/el/TestMethodExpressionImpl.java @@ -45,37 +45,30 @@ public class TestMethodExpressionImpl { TesterBeanA beanA = new TesterBeanA(); beanA.setName("A"); - context.getVariableMapper().setVariable("beanA", - factory.createValueExpression(beanA, TesterBeanA.class)); + context.getVariableMapper().setVariable("beanA", factory.createValueExpression(beanA, TesterBeanA.class)); TesterBeanAA beanAA = new TesterBeanAA(); beanAA.setName("AA"); - context.getVariableMapper().setVariable("beanAA", - factory.createValueExpression(beanAA, TesterBeanAA.class)); + context.getVariableMapper().setVariable("beanAA", factory.createValueExpression(beanAA, TesterBeanAA.class)); TesterBeanAAA beanAAA = new TesterBeanAAA(); beanAAA.setName("AAA"); - context.getVariableMapper().setVariable("beanAAA", - factory.createValueExpression(beanAAA, TesterBeanAAA.class)); + context.getVariableMapper().setVariable("beanAAA", factory.createValueExpression(beanAAA, TesterBeanAAA.class)); beanB = new TesterBeanB(); beanB.setName("B"); - context.getVariableMapper().setVariable("beanB", - factory.createValueExpression(beanB, TesterBeanB.class)); + context.getVariableMapper().setVariable("beanB", factory.createValueExpression(beanB, TesterBeanB.class)); TesterBeanBB beanBB = new TesterBeanBB(); beanBB.setName("BB"); - context.getVariableMapper().setVariable("beanBB", - factory.createValueExpression(beanBB, TesterBeanBB.class)); + context.getVariableMapper().setVariable("beanBB", factory.createValueExpression(beanBB, TesterBeanBB.class)); TesterBeanBBB beanBBB = new TesterBeanBBB(); beanBBB.setName("BBB"); - context.getVariableMapper().setVariable("beanBBB", - factory.createValueExpression(beanBBB, TesterBeanBBB.class)); + context.getVariableMapper().setVariable("beanBBB", factory.createValueExpression(beanBBB, TesterBeanBBB.class)); TesterBeanC beanC = new TesterBeanC(); - context.getVariableMapper().setVariable("beanC", - factory.createValueExpression(beanC, TesterBeanC.class)); + context.getVariableMapper().setVariable("beanC", factory.createValueExpression(beanC, TesterBeanC.class)); TesterBeanEnum beanEnum = new TesterBeanEnum(); context.getVariableMapper().setVariable("beanEnum", @@ -84,10 +77,9 @@ public class TestMethodExpressionImpl { @Test public void testIsParametersProvided() { - MethodExpression me1 = factory.createMethodExpression( - context, "${beanB.getName}", String.class, new Class<?>[] {}); - MethodExpression me2 = factory.createMethodExpression( - context, "${beanB.sayHello('JUnit')}", String.class, + MethodExpression me1 = factory.createMethodExpression(context, "${beanB.getName}", String.class, + new Class<?>[] {}); + MethodExpression me2 = factory.createMethodExpression(context, "${beanB.sayHello('JUnit')}", String.class, new Class<?>[] { String.class }); Assert.assertFalse(me1.isParametersProvided()); @@ -96,101 +88,86 @@ public class TestMethodExpressionImpl { @Test public void testInvoke() { - MethodExpression me1 = factory.createMethodExpression( - context, "${beanB.getName}", String.class, new Class<?>[] {}); - MethodExpression me2 = factory.createMethodExpression( - context, "${beanB.sayHello('JUnit')}", String.class, + MethodExpression me1 = factory.createMethodExpression(context, "${beanB.getName}", String.class, + new Class<?>[] {}); + MethodExpression me2 = factory.createMethodExpression(context, "${beanB.sayHello('JUnit')}", String.class, new Class<?>[] { String.class }); - MethodExpression me3 = factory.createMethodExpression( - context, "${beanB.sayHello}", String.class, + MethodExpression me3 = factory.createMethodExpression(context, "${beanB.sayHello}", String.class, new Class<?>[] { String.class }); Assert.assertEquals("B", me1.invoke(context, null)); Assert.assertEquals("Hello JUnit from B", me2.invoke(context, null)); - Assert.assertEquals("Hello JUnit from B", - me2.invoke(context, new Object[] { "JUnit2" })); - Assert.assertEquals("Hello JUnit2 from B", - me3.invoke(context, new Object[] { "JUnit2" })); - Assert.assertEquals("Hello JUnit from B", - me2.invoke(context, new Object[] { null })); - Assert.assertEquals("Hello from B", - me3.invoke(context, new Object[] { null })); + Assert.assertEquals("Hello JUnit from B", me2.invoke(context, new Object[] { "JUnit2" })); + Assert.assertEquals("Hello JUnit2 from B", me3.invoke(context, new Object[] { "JUnit2" })); + Assert.assertEquals("Hello JUnit from B", me2.invoke(context, new Object[] { null })); + Assert.assertEquals("Hello from B", me3.invoke(context, new Object[] { null })); } @Test public void testInvokeWithSuper() { - MethodExpression me = factory.createMethodExpression(context, - "${beanA.setBean(beanBB)}", null , + MethodExpression me = factory.createMethodExpression(context, "${beanA.setBean(beanBB)}", null, new Class<?>[] { TesterBeanB.class }); me.invoke(context, null); - ValueExpression ve = factory.createValueExpression(context, - "${beanA.bean.name}", String.class); + ValueExpression ve = factory.createValueExpression(context, "${beanA.bean.name}", String.class); Object r = ve.getValue(context); Assert.assertEquals("BB", r); } @Test public void testInvokeWithSuperABNoReturnTypeNoParamTypes() { - MethodExpression me2 = factory.createMethodExpression(context, - "${beanC.sayHello(beanA,beanB)}", null , null); + MethodExpression me2 = factory.createMethodExpression(context, "${beanC.sayHello(beanA,beanB)}", null, null); Object r2 = me2.invoke(context, null); Assert.assertEquals("AB: Hello A from B", r2.toString()); } @Test public void testInvokeWithSuperABReturnTypeNoParamTypes() { - MethodExpression me3 = factory.createMethodExpression(context, - "${beanC.sayHello(beanA,beanB)}", String.class , null); + MethodExpression me3 = factory.createMethodExpression(context, "${beanC.sayHello(beanA,beanB)}", String.class, + null); Object r3 = me3.invoke(context, null); Assert.assertEquals("AB: Hello A from B", r3.toString()); } @Test public void testInvokeWithSuperABNoReturnTypeParamTypes() { - MethodExpression me4 = factory.createMethodExpression(context, - "${beanC.sayHello(beanA,beanB)}", null , - new Class<?>[] {TesterBeanA.class, TesterBeanB.class}); + MethodExpression me4 = factory.createMethodExpression(context, "${beanC.sayHello(beanA,beanB)}", null, + new Class<?>[] { TesterBeanA.class, TesterBeanB.class }); Object r4 = me4.invoke(context, null); Assert.assertEquals("AB: Hello A from B", r4.toString()); } @Test public void testInvokeWithSuperABReturnTypeParamTypes() { - MethodExpression me5 = factory.createMethodExpression(context, - "${beanC.sayHello(beanA,beanB)}", String.class , - new Class<?>[] {TesterBeanA.class, TesterBeanB.class}); + MethodExpression me5 = factory.createMethodExpression(context, "${beanC.sayHello(beanA,beanB)}", String.class, + new Class<?>[] { TesterBeanA.class, TesterBeanB.class }); Object r5 = me5.invoke(context, null); Assert.assertEquals("AB: Hello A from B", r5.toString()); } @Test public void testInvokeWithSuperABB() { - MethodExpression me6 = factory.createMethodExpression(context, - "${beanC.sayHello(beanA,beanBB)}", null , null); + MethodExpression me6 = factory.createMethodExpression(context, "${beanC.sayHello(beanA,beanBB)}", null, null); Object r6 = me6.invoke(context, null); Assert.assertEquals("ABB: Hello A from BB", r6.toString()); } @Test public void testInvokeWithSuperABBB() { - MethodExpression me7 = factory.createMethodExpression(context, - "${beanC.sayHello(beanA,beanBBB)}", null , null); + MethodExpression me7 = factory.createMethodExpression(context, "${beanC.sayHello(beanA,beanBBB)}", null, null); Object r7 = me7.invoke(context, null); Assert.assertEquals("ABB: Hello A from BBB", r7.toString()); } @Test public void testInvokeWithSuperAAB() { - MethodExpression me8 = factory.createMethodExpression(context, - "${beanC.sayHello(beanAA,beanB)}", null , null); + MethodExpression me8 = factory.createMethodExpression(context, "${beanC.sayHello(beanAA,beanB)}", null, null); Object r8 = me8.invoke(context, null); Assert.assertEquals("AAB: Hello AA from B", r8.toString()); } @Test public void testInvokeWithSuperAABB() { - MethodExpression me9 = factory.createMethodExpression(context, - "${beanC.sayHello(beanAA,beanBB)}", null , null); + MethodExpression me9 = factory.createMethodExpression(context, "${beanC.sayHello(beanAA,beanBB)}", null, null); Exception e = null; try { me9.invoke(context, null); @@ -206,16 +183,15 @@ public class TestMethodExpressionImpl { // The Java compiler reports this as ambiguous. Using the parameter that // matches exactly seems reasonable to limit the scope of the method // search so the EL will find a match. - MethodExpression me10 = factory.createMethodExpression(context, - "${beanC.sayHello(beanAA,beanBBB)}", null , null); + MethodExpression me10 = factory.createMethodExpression(context, "${beanC.sayHello(beanAA,beanBBB)}", null, + null); Object r10 = me10.invoke(context, null); Assert.assertEquals("AAB: Hello AA from BBB", r10.toString()); } @Test public void testInvokeWithSuperAAAB() { - MethodExpression me11 = factory.createMethodExpression(context, - "${beanC.sayHello(beanAAA,beanB)}", null , null); + MethodExpression me11 = factory.createMethodExpression(context, "${beanC.sayHello(beanAAA,beanB)}", null, null); Object r11 = me11.invoke(context, null); Assert.assertEquals("AAB: Hello AAA from B", r11.toString()); } @@ -225,16 +201,16 @@ public class TestMethodExpressionImpl { // The Java compiler reports this as ambiguous. Using the parameter that // matches exactly seems reasonable to limit the scope of the method // search so the EL will find a match. - MethodExpression me12 = factory.createMethodExpression(context, - "${beanC.sayHello(beanAAA,beanBB)}", null , null); + MethodExpression me12 = factory.createMethodExpression(context, "${beanC.sayHello(beanAAA,beanBB)}", null, + null); Object r12 = me12.invoke(context, null); Assert.assertEquals("ABB: Hello AAA from BB", r12.toString()); } @Test public void testInvokeWithSuperAAABBB() { - MethodExpression me13 = factory.createMethodExpression(context, - "${beanC.sayHello(beanAAA,beanBBB)}", null , null); + MethodExpression me13 = factory.createMethodExpression(context, "${beanC.sayHello(beanAAA,beanBBB)}", null, + null); Exception e = null; try { me13.invoke(context, null); @@ -247,8 +223,8 @@ public class TestMethodExpressionImpl { @Test public void testInvokeWithVarArgsAB() throws Exception { - MethodExpression me1 = factory.createMethodExpression(context, - "${beanC.sayHello(beanA,beanB,beanB)}", null , null); + MethodExpression me1 = factory.createMethodExpression(context, "${beanC.sayHello(beanA,beanB,beanB)}", null, + null); Exception e = null; try { me1.invoke(context, null); @@ -261,24 +237,24 @@ public class TestMethodExpressionImpl { @Test public void testInvokeWithVarArgsABB() throws Exception { - MethodExpression me2 = factory.createMethodExpression(context, - "${beanC.sayHello(beanA,beanBB,beanBB)}", null , null); + MethodExpression me2 = factory.createMethodExpression(context, "${beanC.sayHello(beanA,beanBB,beanBB)}", null, + null); Object r2 = me2.invoke(context, null); Assert.assertEquals("ABB[]: Hello A from BB, BB", r2.toString()); } @Test public void testInvokeWithVarArgsABBB() throws Exception { - MethodExpression me3 = factory.createMethodExpression(context, - "${beanC.sayHello(beanA,beanBBB,beanBBB)}", null , null); + MethodExpression me3 = factory.createMethodExpression(context, "${beanC.sayHello(beanA,beanBBB,beanBBB)}", null, + null); Object r3 = me3.invoke(context, null); Assert.assertEquals("ABB[]: Hello A from BBB, BBB", r3.toString()); } @Test public void testInvokeWithVarArgsAAB() throws Exception { - MethodExpression me4 = factory.createMethodExpression(context, - "${beanC.sayHello(beanAA,beanB,beanB)}", null , null); + MethodExpression me4 = factory.createMethodExpression(context, "${beanC.sayHello(beanAA,beanB,beanB)}", null, + null); Exception e = null; try { me4.invoke(context, null); @@ -291,24 +267,24 @@ public class TestMethodExpressionImpl { @Test public void testInvokeWithVarArgsAABB() throws Exception { - MethodExpression me5 = factory.createMethodExpression(context, - "${beanC.sayHello(beanAA,beanBB,beanBB)}", null , null); + MethodExpression me5 = factory.createMethodExpression(context, "${beanC.sayHello(beanAA,beanBB,beanBB)}", null, + null); Object r5 = me5.invoke(context, null); Assert.assertEquals("ABB[]: Hello AA from BB, BB", r5.toString()); } @Test public void testInvokeWithVarArgsAABBB() throws Exception { - MethodExpression me6 = factory.createMethodExpression(context, - "${beanC.sayHello(beanAA,beanBBB,beanBBB)}", null , null); + MethodExpression me6 = factory.createMethodExpression(context, "${beanC.sayHello(beanAA,beanBBB,beanBBB)}", + null, null); Object r6 = me6.invoke(context, null); Assert.assertEquals("ABB[]: Hello AA from BBB, BBB", r6.toString()); } @Test public void testInvokeWithVarArgsAAAB() throws Exception { - MethodExpression me7 = factory.createMethodExpression(context, - "${beanC.sayHello(beanAAA,beanB,beanB)}", null , null); + MethodExpression me7 = factory.createMethodExpression(context, "${beanC.sayHello(beanAAA,beanB,beanB)}", null, + null); Exception e = null; try { me7.invoke(context, null); @@ -321,100 +297,89 @@ public class TestMethodExpressionImpl { @Test public void testInvokeWithVarArgsAAABB() throws Exception { - MethodExpression me8 = factory.createMethodExpression(context, - "${beanC.sayHello(beanAAA,beanBB,beanBB)}", null , null); + MethodExpression me8 = factory.createMethodExpression(context, "${beanC.sayHello(beanAAA,beanBB,beanBB)}", null, + null); Object r8 = me8.invoke(context, null); Assert.assertEquals("ABB[]: Hello AAA from BB, BB", r8.toString()); } @Test public void testInvokeWithVarArgsAAABBB() throws Exception { - MethodExpression me9 = factory.createMethodExpression(context, - "${beanC.sayHello(beanAAA,beanBBB,beanBBB)}", null , null); + MethodExpression me9 = factory.createMethodExpression(context, "${beanC.sayHello(beanAAA,beanBBB,beanBBB)}", + null, null); Object r9 = me9.invoke(context, null); Assert.assertEquals("ABB[]: Hello AAA from BBB, BBB", r9.toString()); } /* - * This is also tested implicitly in numerous places elsewhere in this - * class. + * This is also tested implicitly in numerous places elsewhere in this class. */ @Test public void testBug49655() throws Exception { // This is the call the failed - MethodExpression me = factory.createMethodExpression(context, - "#{beanA.setName('New value')}", null, null); + MethodExpression me = factory.createMethodExpression(context, "#{beanA.setName('New value')}", null, null); // The rest is to check it worked correctly me.invoke(context, null); - ValueExpression ve = factory.createValueExpression(context, - "#{beanA.name}", java.lang.String.class); + ValueExpression ve = factory.createValueExpression(context, "#{beanA.name}", java.lang.String.class); Assert.assertEquals("New value", ve.getValue(context)); } @Test public void testBugPrimitives() throws Exception { - MethodExpression me = factory.createMethodExpression(context, - "${beanA.setValLong(5)}", null, null); + MethodExpression me = factory.createMethodExpression(context, "${beanA.setValLong(5)}", null, null); me.invoke(context, null); - ValueExpression ve = factory.createValueExpression(context, - "#{beanA.valLong}", java.lang.String.class); + ValueExpression ve = factory.createValueExpression(context, "#{beanA.valLong}", java.lang.String.class); Assert.assertEquals("5", ve.getValue(context)); } @Test public void testBug50449a() throws Exception { - MethodExpression me1 = factory.createMethodExpression(context, - "${beanB.sayHello()}", null, null); + MethodExpression me1 = factory.createMethodExpression(context, "${beanB.sayHello()}", null, null); String actual = (String) me1.invoke(context, null); Assert.assertEquals("Hello from B", actual); } @Test public void testBug50449b() throws Exception { - MethodExpression me1 = factory.createMethodExpression(context, - "${beanB.sayHello('Tomcat')}", null, null); + MethodExpression me1 = factory.createMethodExpression(context, "${beanB.sayHello('Tomcat')}", null, null); String actual = (String) me1.invoke(context, null); Assert.assertEquals("Hello Tomcat from B", actual); } @Test public void testBug50790a() throws Exception { - ValueExpression ve = factory.createValueExpression(context, - "#{beanAA.name.contains(beanA.name)}", java.lang.Boolean.class); + ValueExpression ve = factory.createValueExpression(context, "#{beanAA.name.contains(beanA.name)}", + java.lang.Boolean.class); Boolean actual = (Boolean) ve.getValue(context); Assert.assertEquals(Boolean.TRUE, actual); } @Test public void testBug50790b() throws Exception { - ValueExpression ve = factory.createValueExpression(context, - "#{beanA.name.contains(beanAA.name)}", java.lang.Boolean.class); + ValueExpression ve = factory.createValueExpression(context, "#{beanA.name.contains(beanAA.name)}", + java.lang.Boolean.class); Boolean actual = (Boolean) ve.getValue(context); Assert.assertEquals(Boolean.FALSE, actual); } @Test public void testBug52445a() { - MethodExpression me = factory.createMethodExpression(context, - "${beanA.setBean(beanBB)}", null , + MethodExpression me = factory.createMethodExpression(context, "${beanA.setBean(beanBB)}", null, new Class<?>[] { TesterBeanB.class }); me.invoke(context, null); - MethodExpression me1 = factory.createMethodExpression(context, - "${beanA.bean.sayHello()}", null, null); + MethodExpression me1 = factory.createMethodExpression(context, "${beanA.bean.sayHello()}", null, null); String actual = (String) me1.invoke(context, null); Assert.assertEquals("Hello from BB", actual); } @Test public void testBug52970() { - MethodExpression me = factory.createMethodExpression(context, - "${beanEnum.submit('APPLE')}", null , + MethodExpression me = factory.createMethodExpression(context, "${beanEnum.submit('APPLE')}", null, new Class<?>[] { TesterBeanEnum.class }); me.invoke(context, null); - ValueExpression ve = factory.createValueExpression(context, - "#{beanEnum.lastSubmitted}", TesterEnum.class); + ValueExpression ve = factory.createValueExpression(context, "#{beanEnum.lastSubmitted}", TesterEnum.class); TesterEnum actual = (TesterEnum) ve.getValue(context); Assert.assertEquals(TesterEnum.APPLE, actual); @@ -422,34 +387,29 @@ public class TestMethodExpressionImpl { @Test public void testBug53792a() { - MethodExpression me = factory.createMethodExpression(context, - "${beanA.setBean(beanB)}", null , + MethodExpression me = factory.createMethodExpression(context, "${beanA.setBean(beanB)}", null, new Class<?>[] { TesterBeanB.class }); me.invoke(context, null); - me = factory.createMethodExpression(context, - "${beanB.setName('" + BUG53792 + "')}", null , + me = factory.createMethodExpression(context, "${beanB.setName('" + BUG53792 + "')}", null, new Class<?>[] { TesterBeanB.class }); me.invoke(context, null); - ValueExpression ve = factory.createValueExpression(context, - "#{beanA.getBean().name}", java.lang.String.class); + ValueExpression ve = factory.createValueExpression(context, "#{beanA.getBean().name}", java.lang.String.class); String actual = (String) ve.getValue(context); Assert.assertEquals(BUG53792, actual); } @Test public void testBug53792b() { - MethodExpression me = factory.createMethodExpression(context, - "${beanA.setBean(beanB)}", null , + MethodExpression me = factory.createMethodExpression(context, "${beanA.setBean(beanB)}", null, new Class<?>[] { TesterBeanB.class }); me.invoke(context, null); - me = factory.createMethodExpression(context, - "${beanB.setName('" + BUG53792 + "')}", null , + me = factory.createMethodExpression(context, "${beanB.setName('" + BUG53792 + "')}", null, new Class<?>[] { TesterBeanB.class }); me.invoke(context, null); - ValueExpression ve = factory.createValueExpression(context, - "#{beanA.getBean().name.length()}", java.lang.Integer.class); + ValueExpression ve = factory.createValueExpression(context, "#{beanA.getBean().name.length()}", + java.lang.Integer.class); Integer actual = (Integer) ve.getValue(context); Assert.assertEquals(Integer.valueOf(BUG53792.length()), actual); } @@ -457,8 +417,8 @@ public class TestMethodExpressionImpl { @Test public void testBug53792c() { - MethodExpression me = factory.createMethodExpression(context, - "#{beanB.sayHello().length()}", null, new Class<?>[] {}); + MethodExpression me = factory.createMethodExpression(context, "#{beanB.sayHello().length()}", null, + new Class<?>[] {}); Integer result = (Integer) me.invoke(context, null); Assert.assertEquals(beanB.sayHello().length(), result.intValue()); } @@ -466,8 +426,8 @@ public class TestMethodExpressionImpl { @Test public void testBug53792d() { - MethodExpression me = factory.createMethodExpression(context, - "#{beanB.sayHello().length()}", null, new Class<?>[] {}); + MethodExpression me = factory.createMethodExpression(context, "#{beanB.sayHello().length()}", null, + new Class<?>[] {}); Integer result = (Integer) me.invoke(context, new Object[] { "foo" }); Assert.assertEquals(beanB.sayHello().length(), result.intValue()); } @@ -475,8 +435,7 @@ public class TestMethodExpressionImpl { @Test public void testBug56797a() { - MethodExpression me = factory.createMethodExpression(context, - "${beanAA.echo1('Hello World!')}", null , null); + MethodExpression me = factory.createMethodExpression(context, "${beanAA.echo1('Hello World!')}", null, null); Object r = me.invoke(context, null); Assert.assertEquals("AA1Hello World!", r.toString()); } @@ -484,57 +443,56 @@ public class TestMethodExpressionImpl { @Test public void testBug56797b() { - MethodExpression me = factory.createMethodExpression(context, - "${beanAA.echo2('Hello World!')}", null , null); + MethodExpression me = factory.createMethodExpression(context, "${beanAA.echo2('Hello World!')}", null, null); Object r = me.invoke(context, null); Assert.assertEquals("AA2Hello World!", r.toString()); } - @Test(expected=MethodNotFoundException.class) + @Test(expected = MethodNotFoundException.class) public void testBug57855a() { - MethodExpression me = factory.createMethodExpression(context, - "${beanAA.echo2}", null , new Class[]{String.class}); + MethodExpression me = factory.createMethodExpression(context, "${beanAA.echo2}", null, + new Class[] { String.class }); me.invoke(context, new Object[0]); } - @Test(expected=IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void testBug57855b() { - MethodExpression me = factory.createMethodExpression(context, - "${beanAA.echo2}", null , new Class[]{String.class}); + MethodExpression me = factory.createMethodExpression(context, "${beanAA.echo2}", null, + new Class[] { String.class }); me.invoke(context, null); } @Test public void testBug57855c() { - MethodExpression me = factory.createMethodExpression(context, - "${beanB.echo}", null , new Class[]{String.class}); + MethodExpression me = factory.createMethodExpression(context, "${beanB.echo}", null, + new Class[] { String.class }); me.invoke(context, null); } @Test public void testBug57855d() { - MethodExpression me = factory.createMethodExpression(context, - "${beanB.echo}", null , new Class[]{String.class}); + MethodExpression me = factory.createMethodExpression(context, "${beanB.echo}", null, + new Class[] { String.class }); Object r = me.invoke(context, new String[] { "aaa" }); Assert.assertEquals("aaa", r.toString()); } - @Test(expected=MethodNotFoundException.class) + @Test(expected = MethodNotFoundException.class) public void testBug57855e() { - MethodExpression me = factory.createMethodExpression(context, - "${beanB.echo}", null , new Class[]{String.class}); + MethodExpression me = factory.createMethodExpression(context, "${beanB.echo}", null, + new Class[] { String.class }); Object r = me.invoke(context, new String[] { "aaa", "bbb" }); Assert.assertEquals("aaa, bbb", r.toString()); } - @Test(expected=IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void testBug60844() { - MethodExpression me2 = factory.createMethodExpression(context, - "${beanC.sayHello}", null , new Class[]{ TesterBeanA.class, TesterBeanB.class}); + MethodExpression me2 = factory.createMethodExpression(context, "${beanC.sayHello}", null, + new Class[] { TesterBeanA.class, TesterBeanB.class }); me2.invoke(context, new Object[] { new Object() }); } @@ -649,7 +607,7 @@ public class TestMethodExpressionImpl { } - private void doTestVarArgsBeanF(String expression, Function<TesterBeanF,String> func) { + private void doTestVarArgsBeanF(String expression, Function<TesterBeanF, String> func) { ELProcessor elp = new ELProcessor(); elp.defineBean("apple", TesterEnum.APPLE); elp.defineBean("beanF", new TesterBeanF()); @@ -769,7 +727,7 @@ public class TestMethodExpressionImpl { } - private void doTestVarArgsBeanG(String expression, Function<TesterBeanG,String> func) { + private void doTestVarArgsBeanG(String expression, Function<TesterBeanG, String> func) { ELProcessor elp = new ELProcessor(); elp.defineBean("apple", TesterEnum.APPLE); elp.defineBean("beanG", new TesterBeanG()); @@ -889,7 +847,7 @@ public class TestMethodExpressionImpl { } - private void doTestVarArgsBeanH(String expression, Function<TesterBeanH,String> func) { + private void doTestVarArgsBeanH(String expression, Function<TesterBeanH, String> func) { ELProcessor elp = new ELProcessor(); elp.defineBean("apple", TesterEnum.APPLE); elp.defineBean("beanH", new TesterBeanH()); @@ -918,8 +876,7 @@ public class TestMethodExpressionImpl { @Test public void testGetMethodInfo01() throws Exception { - MethodExpression me = factory.createMethodExpression(context, - "#{beanA.setName('New value')}", null, null); + MethodExpression me = factory.createMethodExpression(context, "#{beanA.setName('New value')}", null, null); // This is the call that failed MethodInfo mi = me.getMethodInfo(context); // The rest is to check it worked correctly @@ -931,8 +888,8 @@ public class TestMethodExpressionImpl { @Test public void testGetMethodInfo02() throws Exception { - MethodExpression me = factory.createMethodExpression(context, - "#{beanA.setName}", null, new Class[] { String.class } ); + MethodExpression me = factory.createMethodExpression(context, "#{beanA.setName}", null, + new Class[] { String.class }); // This is the call that failed MethodInfo mi = me.getMethodInfo(context); // The rest is to check it worked correctly diff --git a/test/org/apache/el/TestValueExpressionImpl.java b/test/org/apache/el/TestValueExpressionImpl.java index f0dac49a88..bebaa32ba3 100644 --- a/test/org/apache/el/TestValueExpressionImpl.java +++ b/test/org/apache/el/TestValueExpressionImpl.java @@ -41,12 +41,10 @@ public class TestValueExpressionImpl { TesterBeanB beanB = new TesterBeanB(); beanB.setName("Tomcat"); - ValueExpression var = - factory.createValueExpression(beanB, TesterBeanB.class); + ValueExpression var = factory.createValueExpression(beanB, TesterBeanB.class); context.getVariableMapper().setVariable("beanB", var); - ValueExpression ve = factory.createValueExpression( - context, "${beanB.name}", String.class); + ValueExpression ve = factory.createValueExpression(context, "${beanB.name}", String.class); // First check the basics work String result = (String) ve.getValue(context); @@ -67,17 +65,14 @@ public class TestValueExpressionImpl { TesterBeanB beanB = new TesterBeanB(); beanB.setName("Tomcat"); - ValueExpression var = - factory.createValueExpression(beanB, TesterBeanB.class); + ValueExpression var = factory.createValueExpression(beanB, TesterBeanB.class); context.getVariableMapper().setVariable("beanB", var); - ValueExpression var2 = factory.createValueExpression( - context, "${beanB.name}", String.class); + ValueExpression var2 = factory.createValueExpression(context, "${beanB.name}", String.class); context.getVariableMapper().setVariable("foo", var2); - ValueExpression ve = factory.createValueExpression( - context, "${foo}", ValueExpression.class); + ValueExpression ve = factory.createValueExpression(context, "${foo}", ValueExpression.class); // Now check the value reference @@ -98,12 +93,10 @@ public class TestValueExpressionImpl { beanB.setName("Tomcat"); beanA.setBean(beanB); - ValueExpression var = - factory.createValueExpression(beanA, TesterBeanA.class); + ValueExpression var = factory.createValueExpression(beanA, TesterBeanA.class); context.getVariableMapper().setVariable("beanA", var); - ValueExpression ve = factory.createValueExpression( - context, "${beanA.bean.name}", String.class); + ValueExpression ve = factory.createValueExpression(context, "${beanA.bean.name}", String.class); // First check the basics work String result = (String) ve.getValue(context); @@ -124,18 +117,15 @@ public class TestValueExpressionImpl { TesterEnum testEnum = TesterEnum.APPLE; - ValueExpression var = - factory.createValueExpression(testEnum, TesterEnum.class); + ValueExpression var = factory.createValueExpression(testEnum, TesterEnum.class); context.getVariableMapper().setVariable("testEnum", var); // When coercing an Enum to a String, name() should always be used. - ValueExpression ve1 = factory.createValueExpression( - context, "${testEnum}", String.class); + ValueExpression ve1 = factory.createValueExpression(context, "${testEnum}", String.class); String result1 = (String) ve1.getValue(context); Assert.assertEquals("APPLE", result1); - ValueExpression ve2 = factory.createValueExpression( - context, "foo${testEnum}bar", String.class); + ValueExpression ve2 = factory.createValueExpression(context, "foo${testEnum}bar", String.class); String result2 = (String) ve2.getValue(context); Assert.assertEquals("fooAPPLEbar", result2); } @@ -148,21 +138,18 @@ public class TestValueExpressionImpl { Object o1 = "String value"; Object o2 = Integer.valueOf(32); - Map<Object,Object> map = new HashMap<>(); + Map<Object, Object> map = new HashMap<>(); map.put("key1", o1); map.put("key2", o2); - ValueExpression var = - factory.createValueExpression(map, Map.class); + ValueExpression var = factory.createValueExpression(map, Map.class); context.getVariableMapper().setVariable("map", var); - ValueExpression ve1 = factory.createValueExpression( - context, "${map.key1}", Object.class); + ValueExpression ve1 = factory.createValueExpression(context, "${map.key1}", Object.class); ve1.setValue(context, o2); Assert.assertEquals(o2, ve1.getValue(context)); - ValueExpression ve2 = factory.createValueExpression( - context, "${map.key2}", Object.class); + ValueExpression ve2 = factory.createValueExpression(context, "${map.key2}", Object.class); ve2.setValue(context, o1); Assert.assertEquals(o1, ve2.getValue(context)); } @@ -179,17 +166,14 @@ public class TestValueExpressionImpl { list.add(0, o1); list.add(1, o2); - ValueExpression var = - factory.createValueExpression(list, List.class); + ValueExpression var = factory.createValueExpression(list, List.class); context.getVariableMapper().setVariable("list", var); - ValueExpression ve1 = factory.createValueExpression( - context, "${list[0]}", Object.class); + ValueExpression ve1 = factory.createValueExpression(context, "${list[0]}", Object.class); ve1.setValue(context, o2); Assert.assertEquals(o2, ve1.getValue(context)); - ValueExpression ve2 = factory.createValueExpression( - context, "${list[1]}", Object.class); + ValueExpression ve2 = factory.createValueExpression(context, "${list[1]}", Object.class); ve2.setValue(context, o1); Assert.assertEquals(o1, ve2.getValue(context)); } @@ -206,12 +190,10 @@ public class TestValueExpressionImpl { TesterBeanA beanA = new TesterBeanA(); beanA.setValList(Collections.emptyList()); - ValueExpression var = - factory.createValueExpression(beanA, TesterBeanA.class); + ValueExpression var = factory.createValueExpression(beanA, TesterBeanA.class); context.getVariableMapper().setVariable("beanA", var); - ValueExpression ve = factory.createValueExpression( - context, "${beanA.valList.size()}", Integer.class); + ValueExpression ve = factory.createValueExpression(context, "${beanA.valList.size()}", Integer.class); Integer result = (Integer) ve.getValue(context); Assert.assertEquals(Integer.valueOf(0), result); @@ -228,12 +210,10 @@ public class TestValueExpressionImpl { List<?> list = Collections.emptyList(); - ValueExpression var = - factory.createValueExpression(list, List.class); + ValueExpression var = factory.createValueExpression(list, List.class); context.getVariableMapper().setVariable("list", var); - ValueExpression ve = factory.createValueExpression( - context, "${list.size()}", Integer.class); + ValueExpression ve = factory.createValueExpression(context, "${list.size()}", Integer.class); Integer result = (Integer) ve.getValue(context); Assert.assertEquals(Integer.valueOf(0), result); @@ -247,12 +227,10 @@ public class TestValueExpressionImpl { TesterBeanB beanB = new TesterBeanB(); beanB.setName("Tomcat"); - ValueExpression var = - factory.createValueExpression(beanB, TesterBeanB.class); + ValueExpression var = factory.createValueExpression(beanB, TesterBeanB.class); context.getVariableMapper().setVariable("beanB", var); - ValueExpression ve = factory.createValueExpression( - context, "${beanB.name}", String.class); + ValueExpression ve = factory.createValueExpression(context, "${beanB.name}", String.class); // First check the basics work String result = (String) ve.getValue(context); diff --git a/test/org/apache/el/TesterBeanB.java b/test/org/apache/el/TesterBeanB.java index f1cd34392e..e98f6eef96 100644 --- a/test/org/apache/el/TesterBeanB.java +++ b/test/org/apache/el/TesterBeanB.java @@ -35,7 +35,7 @@ public class TesterBeanB { return "Hello " + to + " from " + name; } - public String echo(String...strings) { + public String echo(String... strings) { if (strings == null) { return null; } diff --git a/test/org/apache/el/TesterBeanC.java b/test/org/apache/el/TesterBeanC.java index 16438529e4..aa4801e50a 100644 --- a/test/org/apache/el/TesterBeanC.java +++ b/test/org/apache/el/TesterBeanC.java @@ -20,15 +20,17 @@ public class TesterBeanC { public String sayHello(TesterBeanA a, TesterBeanB b) { return "AB: Hello " + a.getName() + " from " + b.getName(); } + public String sayHello(TesterBeanAA a, TesterBeanB b) { return "AAB: Hello " + a.getName() + " from " + b.getName(); } + public String sayHello(TesterBeanA a, TesterBeanBB b) { return "ABB: Hello " + a.getName() + " from " + b.getName(); } + public String sayHello(TesterBeanA a, TesterBeanBB... b) { - StringBuilder result = - new StringBuilder("ABB[]: Hello " + a.getName() + " from "); + StringBuilder result = new StringBuilder("ABB[]: Hello " + a.getName() + " from "); for (int i = 0; i < b.length; i++) { if (i > 0) { result.append(", "); diff --git a/test/org/apache/el/TesterBeanF.java b/test/org/apache/el/TesterBeanF.java index 242cab0af7..42e340c13b 100644 --- a/test/org/apache/el/TesterBeanF.java +++ b/test/org/apache/el/TesterBeanF.java @@ -40,13 +40,13 @@ public class TesterBeanF { @SuppressWarnings("unused") - public String doTest(TesterEnum param1, TesterEnum... param2 ) { + public String doTest(TesterEnum param1, TesterEnum... param2) { return "Enum-VEnum"; } @SuppressWarnings("unused") - public String doTest(TesterEnum param1, String... param2 ) { + public String doTest(TesterEnum param1, String... param2) { return "Enum-VString"; } @@ -70,13 +70,13 @@ public class TesterBeanF { @SuppressWarnings("unused") - public String doTest(String param1, TesterEnum... param2 ) { + public String doTest(String param1, TesterEnum... param2) { return "String-VEnum"; } @SuppressWarnings("unused") - public String doTest(String param1, String... param2 ) { + public String doTest(String param1, String... param2) { return "String-VString"; } } diff --git a/test/org/apache/el/TesterBeanG.java b/test/org/apache/el/TesterBeanG.java index 4872781637..87a03abbc0 100644 --- a/test/org/apache/el/TesterBeanG.java +++ b/test/org/apache/el/TesterBeanG.java @@ -17,9 +17,8 @@ package org.apache.el; /** - * Test cases based on https://bz.apache.org/bugzilla/show_bug.cgi?id=65358 - * BeanG is BeanF with all the methods that use Enum parameters removed so that - * the EL caller always has to coerce the Enum to String. + * Test cases based on https://bz.apache.org/bugzilla/show_bug.cgi?id=65358 BeanG is BeanF with all the methods that use + * Enum parameters removed so that the EL caller always has to coerce the Enum to String. */ public class TesterBeanG { @@ -36,7 +35,7 @@ public class TesterBeanG { @SuppressWarnings("unused") - public String doTest(String param1, String... param2 ) { + public String doTest(String param1, String... param2) { return "String-VString"; } } diff --git a/test/org/apache/el/TesterBeanH.java b/test/org/apache/el/TesterBeanH.java index 7ebd5c0927..f6d7f0c482 100644 --- a/test/org/apache/el/TesterBeanH.java +++ b/test/org/apache/el/TesterBeanH.java @@ -17,13 +17,12 @@ package org.apache.el; /** - * Test cases based on https://bz.apache.org/bugzilla/show_bug.cgi?id=65358 - * BeanH is BeanG with just the varargs method. + * Test cases based on https://bz.apache.org/bugzilla/show_bug.cgi?id=65358 BeanH is BeanG with just the varargs method. */ public class TesterBeanH { @SuppressWarnings("unused") - public String doTest(String param1, String... param2 ) { + public String doTest(String param1, String... param2) { return "String-VString"; } } diff --git a/test/org/apache/el/TesterEnum.java b/test/org/apache/el/TesterEnum.java index 241fbbe336..1ff0bbf8d9 100644 --- a/test/org/apache/el/TesterEnum.java +++ b/test/org/apache/el/TesterEnum.java @@ -17,7 +17,8 @@ package org.apache.el; public enum TesterEnum { - APPLE, ORANGE; + APPLE, + ORANGE; @Override public String toString() { diff --git a/test/org/apache/el/TesterFunctions.java b/test/org/apache/el/TesterFunctions.java index a1fb8e5cc3..12543428ce 100644 --- a/test/org/apache/el/TesterFunctions.java +++ b/test/org/apache/el/TesterFunctions.java @@ -52,6 +52,7 @@ public class TesterFunctions { public static class Inner$Class { public static final String RETVAL = "Return from bug49555"; + public static String bug49555() { return RETVAL; } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org