In the EL 3.0 Spec, section 1.22.3 "Constructor Reference"  states "A class 
name reference, followed by arguments in parenthesis, such as "Boolean(true)" 
denotes the invocation of the constructor of the class with the supplied 
arguments."

This leads me to believe that the following test should work:

    @Test
    public void testImport03() {
        ELProcessor processor = new ELProcessor();
        Object result =
                processor.getValue("Integer('1000')",
                        Integer.class);
        Assert.assertEquals(Integer.valueOf(1000), result);
    }

Unfortunately, this fails with the following error.

javax.el.ELException: Function ':Integer' not found
        at org.apache.el.parser.AstFunction.getValue(AstFunction.java:136)
        at 
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:188)
        at javax.el.ELProcessor.getValue(ELProcessor.java:45)
        at 
org.apache.el.parser.TestAstIdentifier.testImport03(TestAstIdentifier.java:53)
…

Is there an example / unit test for EL constructor usage in the Tomcat source?  
I can't seem to find one.

Thanks

Dan


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

Reply via email to