[ 
https://issues.apache.org/jira/browse/WW-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14059407#comment-14059407
 ] 

Hudson commented on WW-4167:
----------------------------

SUCCESS: Integrated in Struts-JDK6-develop #63 (See 
[https://builds.apache.org/job/Struts-JDK6-develop/63/])
WW-4167 Renames based class to match the rest based classes (lukaszlenart: rev 
351263a679dd72dc30e700d7eeed77f89e5bafac)
* 
xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/DateRangeFieldValidator.java
* 
xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/ShortRangeFieldValidator.java
* 
xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/LongRangeFieldValidator.java
* 
xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/AbstractRangeValidator.java
* 
xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/RangeValidatorSupport.java
* 
xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/IntRangeFieldValidator.java


> Unable to create a custom validator inheriting IntRangeFieldValidator
> ---------------------------------------------------------------------
>
>                 Key: WW-4167
>                 URL: https://issues.apache.org/jira/browse/WW-4167
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.3.15.1
>         Environment: Windows 7 64bit, Java Runtime Environment 7, Tomcat 7
> CentOS 5 32bit, Java Runtime Environment 6, Tomcat 6
>            Reporter: recyclebin5385
>            Assignee: Lukasz Lenart
>            Priority: Minor
>             Fix For: 2.3.18
>
>
> I created a custom struts validator class which inherits 
> IntRangeFieldValidator, but a runtime error occurs when checking a input 
> value with the validator.
> When I examined the internal data with a debugger, properties "min" and "max" 
> of the custom class were stored as Strings, not Integers.
> Parameters "min" and "max" are read from [ActionName]-validation.xml, 
> converted to Integers, and set to the properties of a validator instance 
> using OGNL.
> But the conversion to Integers is skipped for a derived class of 
> IntRangeFieldValidator.
> The cause seems to be a bug in OGNL library. See 
> https://issues.apache.org/jira/browse/OGNL-238.
> Methods setMin and setMax's argument types are the type parameter T in 
> AbstractRangeValidator<T>.
> OGNL library handles the type parameter for a directly derived class of a 
> generic class, but not for an indirectly derived one.
> A workaround is to override all getters and setters with a parameterized 
> class in a custom validator class without using a type parameter.
> That is, when I define a class which extends IntRangeFieldValidator, I have 
> to also define methods "Integer getMin()", "void setMin(Integer min)", 
> "Integer getMax()" and "void setMax(Integer max)" in the class.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to