You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by bu...@apache.org on 2003/08/30 19:04:50 UTC

DO NOT REPLY [Bug 22837] New: - Using NumericField with "minimum"(or "maximum") parameter equal to any float value and input a integer value cause a ClassCastException

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22837>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22837

Using NumericField with "minimum"(or "maximum") parameter equal to any float value and input a integer value cause a ClassCastException

           Summary: Using NumericField with "minimum"(or "maximum")
                    parameter equal to any float value and input a integer
                    value cause a ClassCastException
           Product: Tapestry
           Version: 3.0
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Contrib
        AssignedTo: tapestry-dev@jakarta.apache.org
        ReportedBy: juceri@ya.com


After fixing the bug 22835:
If I write this in my ValidatingTest.html:

<input type="text" jwcid="@contrib:NumericField" value="ognl:fieldValue" 
 displayName="FieldName" minimum="10.5" 
 required="ognl:false" type="Integer"/>

If I write the value "20" in the input field I get a
java.lang.ClassCastException when the form is submitted:
Stack Trace: 
 java.lang.Integer.compareTo(Integer.java:913) 
 org.apache.tapestry.valid.NumberValidator$NumberAdaptor.compare(NumberValidator.java:143) 
 org.apache.tapestry.valid.NumberValidator.toObject(NumberValidator.java:285) 
 org.apache.tapestry.valid.ValidField.updateValue(ValidField.java:224) 
 org.apache.tapestry.form.AbstractTextField.renderComponent(AbstractTextField.java:109) 
 org.apache.tapestry.valid.ValidField.renderComponent(ValidField.java:127) 
 org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:896)  

Cause:
  NumericField receive a type parameter but it is not transfered to the
NumberValidator.

Solution:
  Add to the getValidator method in NumeriField.java the line:
	validator.setValueType(getTypeName());
  and declare de abstract method
	public abstract String getTypeName();