Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.1.5-SNAPSHOT
-
None
-
windows XP
Description
I have two inputDate components with their own validators and a compareTo validator:
<t:inputDate id="startDateInput" value="#
{viewController.start}"
type="both" popupCalendar="true">
<f:validator validatorId="validateDate" />
</t:inputDate>
<t:inputDate id="endDateInput" value="#
{viewController.end}"
type="both" popupCalendar="true">
<f:validator validatorId="validateDate" />
<s:validateCompareTo operator="gt" for="startDateInput" message="#
" />
</t:inputDate>
When, for instance, the validator of the "startDateInput" throws a ValidatorException and sets the valid property as false, validateCompareTo raizes a ClastCastException saying that class UserData is not Comparable.
I looking deeper into the source code and found that:
1 - The class UserData is an internal representation of the submitted value by the InputDate component (though the class is public).
2 - The validateCompareTo gets this internal representation when he gets the submitted value because the value is not valid.
3 - When one or both values of the compared components are not Comparable, a ClassCastException is raized.
I am submitting this as a bug because:
1 - I think that internal representations of objects shouldn't be accessed outside the scope of the objects.
2 - The JSF spec 1.1 says that (pag.3-18; 3.2.5.1) :
submittedValue
RW Object
The submitted, unconverted, value of this component. This property should only be set by the decode() method of this component, or its corresponding Renderer, or by the validate method of this component. This property should only be read by the validate() method of this component.
3 - When I saw the Javadoc of validateCompareTo, I found the following statement:
If no comparator is specified, the component values must implement Comparable and are compared using compareTo(). If either value or foreign value does not implement Comparable and no Comparator is specified, validation always succeeds.