You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Markus Fischer <Ma...@knipp.de> on 2016/03/30 14:43:42 UTC

Different name mapping in Struts 2.3.28 (was Re: [ANN] Apache Struts 2.3.28 GA)

Hi all,

after migrating from Struts 2.3.24.1 to 2.3.28, I get several FreeMarker
template errors for missing/null elements for expressions that worked
fine before, like this:

> FreeMarker template error
> 
> The following has evaluated to null or missing:
> ==> iPhone  [in template "..." at line X, column Y]

What the problematic expressions have in common is that the Java methods
they refer to have camel case names with (at least?) two consecutive
upper case letters, as in "isIPhone". This seems to be mapped in a
different way with Struts 2.3.28 than it has been before. (See below for
two examples of the different mapping behaviour in Struts 2.3.24.1 and
2.3.28).

My question is: Is this a bug? Or is this something that was introduced
intentionally to comply with some standard or convention?

Examples for Freemarker expression evaluation

==> iPhone (Method name: isIPhone)

Expr.	| 2.3.24.1	| 2.3.28
iPhone	| OK		| error
IPhone	| OK		| OK


==> hCardElements (getHCardElements)

Expression	| 2.3.24.1	| 2.3.28
hCardElements	| OK 		| error
HCardElements	| OK		| OK


TIA
Markus


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Different name mapping in Struts 2.3.28 (was Re: [ANN] Apache Struts 2.3.28 GA)

Posted by Markus Fischer <Ma...@knipp.de>.
Hi Martin,

>>>> after migrating from Struts 2.3.24.1 to 2.3.28, I get several FreeMarker
>>>> template errors for missing/null elements for expressions that worked
>>>> fine before, like this:
>>>>
>>>> ==> iPhone (Method name: isIPhone)
>>>>
>>>> Expr.   | 2.3.24.1      | 2.3.28
>>>> iPhone  | OK            | error
>>>> IPhone  | OK            | OK 
> 
> MG>markus ..who/what generates text string iPhone instead of IPhone?..can i assume this is USER-AGENT HTTP Header?

"iPhone" is variable in a Freemarker template named that way by a
programmer to refer to the underlying isIPhone Java method. So nothing
that is automatically generated.

> MG>does anyone know if new Freemarker 2.3.28+ will provide OGNL workaround for this testcase?

I'm afraid I don't.

Markus

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Different name mapping in Struts 2.3.28 (was Re: [ANN] Apache Struts 2.3.28 GA)

Posted by Martin Gainty <mg...@hotmail.com>.
              


> Subject: Re: Different name mapping in Struts 2.3.28 (was Re: [ANN] Apache Struts 2.3.28 GA)
> To: user@struts.apache.org
> From: Markus.Fischer@knipp.de
> Date: Wed, 30 Mar 2016 15:20:25 +0200
> 
> Hi Łukasz,
> 
> >> after migrating from Struts 2.3.24.1 to 2.3.28, I get several FreeMarker
> >> template errors for missing/null elements for expressions that worked
> >> fine before, like this:
> >>
> >> ==> iPhone (Method name: isIPhone)
> >>
> >> Expr.   | 2.3.24.1      | 2.3.28
> >> iPhone  | OK            | error
> >> IPhone  | OK            | OK 

MG>markus ..who/what generates text string iPhone instead of IPhone?..can i assume this is USER-AGENT HTTP Header?

MG>does anyone know if new Freemarker 2.3.28+ will provide OGNL workaround for this testcase?
> 
> > It's due to fixed OGNL version which properly supports JavaBean
> > Specifications now. You can revert to prior version of OGNL to keep
> > the old behaviour.
> 
> thank you very much for the quick reply (and all your work for the
> Struts project).
> 
> Cheers,
> Markus
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
 		 	   		  

Re: Different name mapping in Struts 2.3.28 (was Re: [ANN] Apache Struts 2.3.28 GA)

Posted by Markus Fischer <Ma...@knipp.de>.
Hi Łukasz,

>> after migrating from Struts 2.3.24.1 to 2.3.28, I get several FreeMarker
>> template errors for missing/null elements for expressions that worked
>> fine before, like this:
>>
>> ==> iPhone (Method name: isIPhone)
>>
>> Expr.   | 2.3.24.1      | 2.3.28
>> iPhone  | OK            | error
>> IPhone  | OK            | OK

> It's due to fixed OGNL version which properly supports JavaBean
> Specifications now. You can revert to prior version of OGNL to keep
> the old behaviour.

thank you very much for the quick reply (and all your work for the
Struts project).

Cheers,
Markus

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Different name mapping in Struts 2.3.28 (was Re: [ANN] Apache Struts 2.3.28 GA)

Posted by Lukasz Lenart <lu...@apache.org>.
2016-03-30 14:43 GMT+02:00 Markus Fischer <Ma...@knipp.de>:
> Hi all,
>
> after migrating from Struts 2.3.24.1 to 2.3.28, I get several FreeMarker
> template errors for missing/null elements for expressions that worked
> fine before, like this:
>
>> FreeMarker template error
>>
>> The following has evaluated to null or missing:
>> ==> iPhone  [in template "..." at line X, column Y]
>
> What the problematic expressions have in common is that the Java methods
> they refer to have camel case names with (at least?) two consecutive
> upper case letters, as in "isIPhone". This seems to be mapped in a
> different way with Struts 2.3.28 than it has been before. (See below for
> two examples of the different mapping behaviour in Struts 2.3.24.1 and
> 2.3.28).
>
> My question is: Is this a bug? Or is this something that was introduced
> intentionally to comply with some standard or convention?
>
> Examples for Freemarker expression evaluation
>
> ==> iPhone (Method name: isIPhone)
>
> Expr.   | 2.3.24.1      | 2.3.28
> iPhone  | OK            | error
> IPhone  | OK            | OK
>
>
> ==> hCardElements (getHCardElements)
>
> Expression      | 2.3.24.1      | 2.3.28
> hCardElements   | OK            | error
> HCardElements   | OK            | OK

It's due to fixed OGNL version which properly supports JavaBean
Specifications now. You can revert to prior version of OGNL to keep
the old behaviour.

See those issues
https://issues.apache.org/jira/browse/WW-3909
https://issues.apache.org/jira/browse/WW-4616

and here you have another one
https://github.com/jkuhnert/ognl/pull/21


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org