Re: Private setter method breaking application in Tomcat7

2013-02-21 Thread Lukasz Lenart
I would say, this is a bug in Ognl. The problem is in
OgnlRuntime.__getSetMethod(). This method identified with setter to
use base on matching number of parameters (!!!) and sometimes
setId(long) is first and sometimes setId(Object) is on top. I think it
should be rewritten to match on parameter type not only on the number
of parameters,

Please register an issue, but anyway it's a rare case.


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

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



Private setter method breaking application in Tomcat7

2013-02-20 Thread Miguel Almeida
Following a chat with Lukasz on IRC, I post a weird behaviour I got this
morning.

Example:
- QueryAction class with a int selectedParent property
- url on a webpage pointing to:
QueryqueryConversation.action?selectedParent=2
- an action mapping action name=Query* method={1}
class=queryAction
- Application packaged in .war and deployed in two containers: tomcat6
and tomcat7

Problem:
1) In tomcat7 the selectedParent int was 0 when entering the
queryConversation method. in tomcat6 the variable was correctly set to
2.
2) Get request had the correct string:
GET /edc-test/QueryqueryConversation.action?selectedParent=2 HTTP/1.1
3) Params interceptor was picking up the parameter: DEBUG
ParametersInterceptor:68 - Setting params selectedParent = [ 2 ]

Resolution:
I found out the issue was related to the fact that we had two
setSelectedParent methods in the Action class:
- public void setSelectedParent(int selectedParent)
- private void setSelectedParent(ObjectX anotherObjectType)

Renaming the second method (I've always said naming methods with get/set
prefix should be reserved to..well, getters/setters) solved the problem.

Questions:
Two questions remain a mystery to me thought:
1) Why is Tomcat7 the only container complaining? Neither tomcat6 nor
our embedded jetty containers complain about this
2) Even though the method's name should be changed, I also find it
strange that this is a problem when the 2nd method is private.


Any thoughts appreciated,

Miguel Almeida