On Sep 16, 2013, at 9:43 AM, Xavier Dury <[email protected]> wrote:
> I built tomcat from trunk (rev 1523639) and I'm having the same issue I had
> with glassfish EL implementation when using overloaded methods:
>
> javax.el.ELException: Cannot convert ./ of type class java.lang.String to
> class java.net.URI
> at org.apache.el.lang.ELSupport.coerceToType(ELSupport.java:482)
> at
> org.apache.el.ExpressionFactoryImpl.coerceToType(ExpressionFactoryImpl.java:48)
> at javax.el.ELContext.convertToType(ELContext.java:473)
> at
> org.apache.el.lang.EvaluationContext.convertToType(EvaluationContext.java:155)
> at javax.el.ELUtil.invokeConstructor(ELUtil.java:261)
> at javax.el.StaticFieldELResolver.invoke(StaticFieldELResolver.java:203)
> at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:256)
> at org.apache.el.parser.AstFunction.getValue(AstFunction.java:138)
> at
> org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:188)
> at javax.el.ELProcessor.getValue(ELProcessor.java:129)
> at javax.el.ELProcessor.eval(ELProcessor.java:115)
> at
> org.apache.naming.factory.ExpressionFactoryTest.elImplementationShouldWork(ExpressionFactoryTest.java:43)
>
> So I guess it's normal behaviour, isn't it?
No. Your example works fine for me, rev# 1523651.
public class ElFileTest {
@Test
public void testElAndFile() throws IOException {
ELProcessor proc = new ELProcessor();
proc.getELManager().importClass("java.io.File");
File f = (File) proc.eval("File('./')");
Assert.assertEquals(new File("./").getCanonicalPath(),
f.getCanonicalPath());
}
}
Dan
>
> I don't think EL spec does mandate implementations to make their best effort
> to find a suitable method when invoking overloaded methods.
>
> Xavier
>
> ----------------------------------------
>> Subject: Re: Using EL expressions in an ObjectFactory
>> From: [email protected]
>> Date: Mon, 16 Sep 2013 07:48:33 -0400
>> To: [email protected]
>>
>> On Sep 16, 2013, at 3:03 AM, Xavier Dury <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> I switched to org.apache.tomcat:tomcat-jasper-el:8.0.0-RC1 as javax.el 3.0
>>> implementation and tested with the following code:
>>>
>>> ELProcessor processor = new ELProcessor();
>>> processor.getELManager().importClass("java.io.File");
>>> processor.eval("File('./')");
>>>
>>> but I get the following error:
>>>
>>> javax.el.ELException: Function ':File' 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:129)
>>> at javax.el.ELProcessor.eval(ELProcessor.java:115)
>>> at
>>> org.apache.naming.factory.ExpressionFactoryTest.elImplementationShouldWork(ExpressionFactoryTest.java:43)
>>>
>>> Are methods importClass, importStatic and importPackage on ELManager
>>> already implemented in apache EL?
>>
>> Sorry, I don't think I was clear enough in my last response. This does not
>> work with Tomcat 8.0.0-RC1, but has been fixed (see the bug I referenced
>> earlier). You'll need to either build and use Tomcat trunk or wait until the
>> next RC release is available.
>>
>> Dan
>>
>>>
>>> Regards,
>>>
>>> Xavier
>>>
>>> ----------------------------------------
>>>> Subject: Re: Using EL expressions in an ObjectFactory
>>>> From: [email protected]
>>>> Date: Fri, 13 Sep 2013 15:38:29 -0400
>>>> To: [email protected]
>>>>
>>>> On Sep 13, 2013, at 3:27 AM, Xavier Dury <[email protected]> wrote:
>>>>
>>>>> When I try the following:
>>>>>
>>>>> ELProcessor processor = new ELProcessor();
>>>>> processor.getELManager().importClass("java.io.File");
>>>>> processor.eval("File('./')");
>>>>>
>>>>> I get javax.el.ELException: java.lang.IllegalArgumentException: Cannot
>>>>> convert ./ of type class java.lang.String to class java.net.URI.
>>>>>
>>>>> I'm using glassfish javax.el 3.0 implementation for my tests. Maybe the
>>>>> problem comes from this specific implementation.
>>>>
>>>> Yes, that would be the problem. I've noticed the same behavior
>>>> w/GlassFish's EL 3.0 implementation. Try building Tomcat trunk and using
>>>> it's implementation or using the next Tomcat 8 RC when it's available.
>>>> Neither should have that problem.
>>>>
>>>> Dan
>>>>
>>>>
>>>>>
>>>>> ----------------------------------------
>>>>>> Subject: Re: Using EL expressions in an ObjectFactory
>>>>>> From: [email protected]
>>>>>> Date: Thu, 12 Sep 2013 17:10:21 -0400
>>>>>> To: [email protected]
>>>>>>
>>>>>> On Sep 12, 2013, at 7:58 AM, Xavier Dury <[email protected]> wrote:
>>>>>>
>>>>>>> Ok,
>>>>>>>
>>>>>>> I fixed the styling and the documentation. If anything else must be
>>>>>>> changed, don't hesitate.
>>>>>>
>>>>>> In your docs, you state the following remark...
>>>>>>
>>>>>> "Try to avoid overloaded methods/constructors as much as possible in EL
>>>>>> 3.0 expression as the ELProcessor will use the first one it will find by
>>>>>> reflection."
>>>>>>
>>>>>> Can you clarify what you mean by this? There was a problem in RC-1 that
>>>>>> sounds similar, but it's been fixed.
>>>>>>
>>>>>> https://issues.apache.org/bugzilla/show_bug.cgi?id=55483
>>>>>>
>>>>>> Is this a problem in trunk? Point being, if you're seeing an issue with
>>>>>> EL 3.0, we should try to fix it.
>>>>>>
>>>>>> Dan
>>>>>>
>>>>>>
>>>>>>> ----------------------------------------
>>>>>>>> Date: Thu, 12 Sep 2013 12:01:26 +0100
>>>>>>>> From: [email protected]
>>>>>>>> To: [email protected]
>>>>>>>> Subject: Re: Using EL expressions in an ObjectFactory
>>>>>>>>
>>>>>>>> On 12/09/2013 11:49, Xavier Dury wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I implemented a simple ExpressionFactory @
>>>>>>>>> https://github.com/kalgon/expression-factory.
>>>>>>>>>
>>>>>>>>> I would love to see this ExpressionFactory next to
>>>>>>>>> org.apache.naming.factory.BeanFactory in tomcat.
>>>>>>>>
>>>>>>>> No objections in principle.
>>>>>>>>
>>>>>>>> Haven't looked at the new code in detail. A few initial observations:
>>>>>>>> - I'm assuming this is a contribution as per section 5 of the Apache
>>>>>>>> License, version 2.0
>>>>>>>> - There is no documentation
>>>>>>>> - Tomcat code standards use 4 spaces for indents, not tabs
>>>>>>>> - Some @Override markers look to be missing
>>>>>>>>
>>>>>>>> Mark
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>>>> For additional commands, e-mail: [email protected]
>>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>>> For additional commands, e-mail: [email protected]
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>> For additional commands, e-mail: [email protected]
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [email protected]
>>>>> For additional commands, e-mail: [email protected]
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]