You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "thomas bailey (JIRA)" <ji...@apache.org> on 2006/05/29 09:16:16 UTC
[jira] Created: (STR-2880) Validating array integers
Validating array integers
-------------------------
Key: STR-2880
URL: http://issues.apache.org/struts/browse/STR-2880
Project: Struts Action 1
Type: Bug
Components: Unknown
Versions: 1.2 Family
Reporter: thomas bailey
html:
<html:select property="types" multiple="true" size="3" >
<html:option value="1">should work</html:option>
<html:option value="2">should work as well</html:option>
<html:option value="blah">this will fail validation</html:option>
</html:select>
actionform:
public class PropertyFilter implements Serializable
{
private String[] types;
public String[] getTypes() {
return types;
}
public void setTypes(String[] types) {
this.types = types;
}
}
validation.xml:
<formset>
<form name="PropertyFilterForm">
<field property="types" depends="integer">
<arg0 key="text.validation.type"/>
</field>
</form>
</formset>
Even if all values are integer, it will fail validation regardless. According to http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt#18 I should
do something like:
<field property="types" indexedListProperty="types" depends="integer">
<arg0 key="text.validation.type"/>
</field>
This time, it does indeed check all the values are of type integer, however,
if you do not select anything (the field is not required) the result is:
java.lang.NullPointerException
org.apache.commons.validator.Field.getIndexedProperty(Field.java:796)
org.apache.commons.validator.Field.validate(Field.java:891)
..
Also having scoured all documentation in current and future builds and there is no example of validating an integer array.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Commented: (STR-2880) Validating integer arrays
Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/struts/browse/STR-2880?page=comments#action_37415 ]
Niall Pemberton commented on STR-2880:
--------------------------------------
Firstly the only way to resolve this currently is to ensure that your "types" property returns a zero length array rather than null.
I agree this looks like a bug - but it should be filed against Commons Validator rather than Struts. I'll try to find out if I can move this to Jakarta Commons (doesn't look like we can at the moment) - if not it will need to be closed and a new issue created for Commons Validator:
http://jakarta.apache.org/commons/validator/issue-tracking.html
> Validating integer arrays
> -------------------------
>
> Key: STR-2880
> URL: http://issues.apache.org/struts/browse/STR-2880
> Project: Struts Action 1
> Type: Bug
> Components: Unknown
> Versions: 1.2 Family
> Reporter: thomas bailey
>
> There seems to be some issue with validating integer arrays:
> html:
> <html:select property="types" multiple="true" size="3" >
> <html:option value="1">should work</html:option>
> <html:option value="2">should work as well</html:option>
> <html:option value="blah">this will fail validation</html:option>
> </html:select>
> actionform:
> public class PropertyFilter implements Serializable
> {
> private String[] types;
>
> public String[] getTypes() {
> return types;
> }
> public void setTypes(String[] types) {
> this.types = types;
> }
> }
> validation.xml:
>
> <formset>
> <form name="PropertyFilterForm">
>
> <field property="types" depends="integer">
> <arg0 key="text.validation.type"/>
> </field>
>
> </form>
> </formset>
> Even if all values are integer, it will fail validation regardless. According to http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt#18 I should
> do something like:
>
> <field property="types" indexedListProperty="types" depends="integer">
> <arg0 key="text.validation.type"/>
> </field>
>
> This time, it does indeed check all the values are of type integer, however,
> if you do not select anything (the field is not required) the result is:
>
> java.lang.NullPointerException
> org.apache.commons.validator.Field.getIndexedProperty(Field.java:796)
> org.apache.commons.validator.Field.validate(Field.java:891)
> ..
> Also having scoured all documentation in current and future builds and there is no example of validating an integer array.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Updated: (STR-2880) Validating array integers
Posted by "thomas bailey (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/struts/browse/STR-2880?page=all ]
thomas bailey updated STR-2880:
-------------------------------
Description:
There seems to be some issue with validating arrays on integers:
html:
<html:select property="types" multiple="true" size="3" >
<html:option value="1">should work</html:option>
<html:option value="2">should work as well</html:option>
<html:option value="blah">this will fail validation</html:option>
</html:select>
actionform:
public class PropertyFilter implements Serializable
{
private String[] types;
public String[] getTypes() {
return types;
}
public void setTypes(String[] types) {
this.types = types;
}
}
validation.xml:
<formset>
<form name="PropertyFilterForm">
<field property="types" depends="integer">
<arg0 key="text.validation.type"/>
</field>
</form>
</formset>
Even if all values are integer, it will fail validation regardless. According to http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt#18 I should
do something like:
<field property="types" indexedListProperty="types" depends="integer">
<arg0 key="text.validation.type"/>
</field>
This time, it does indeed check all the values are of type integer, however,
if you do not select anything (the field is not required) the result is:
java.lang.NullPointerException
org.apache.commons.validator.Field.getIndexedProperty(Field.java:796)
org.apache.commons.validator.Field.validate(Field.java:891)
..
Also having scoured all documentation in current and future builds and there is no example of validating an integer array.
was:
html:
<html:select property="types" multiple="true" size="3" >
<html:option value="1">should work</html:option>
<html:option value="2">should work as well</html:option>
<html:option value="blah">this will fail validation</html:option>
</html:select>
actionform:
public class PropertyFilter implements Serializable
{
private String[] types;
public String[] getTypes() {
return types;
}
public void setTypes(String[] types) {
this.types = types;
}
}
validation.xml:
<formset>
<form name="PropertyFilterForm">
<field property="types" depends="integer">
<arg0 key="text.validation.type"/>
</field>
</form>
</formset>
Even if all values are integer, it will fail validation regardless. According to http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt#18 I should
do something like:
<field property="types" indexedListProperty="types" depends="integer">
<arg0 key="text.validation.type"/>
</field>
This time, it does indeed check all the values are of type integer, however,
if you do not select anything (the field is not required) the result is:
java.lang.NullPointerException
org.apache.commons.validator.Field.getIndexedProperty(Field.java:796)
org.apache.commons.validator.Field.validate(Field.java:891)
..
Also having scoured all documentation in current and future builds and there is no example of validating an integer array.
> Validating array integers
> -------------------------
>
> Key: STR-2880
> URL: http://issues.apache.org/struts/browse/STR-2880
> Project: Struts Action 1
> Type: Bug
> Components: Unknown
> Versions: 1.2 Family
> Reporter: thomas bailey
>
> There seems to be some issue with validating arrays on integers:
> html:
> <html:select property="types" multiple="true" size="3" >
> <html:option value="1">should work</html:option>
> <html:option value="2">should work as well</html:option>
> <html:option value="blah">this will fail validation</html:option>
> </html:select>
> actionform:
> public class PropertyFilter implements Serializable
> {
> private String[] types;
>
> public String[] getTypes() {
> return types;
> }
> public void setTypes(String[] types) {
> this.types = types;
> }
> }
> validation.xml:
>
> <formset>
> <form name="PropertyFilterForm">
>
> <field property="types" depends="integer">
> <arg0 key="text.validation.type"/>
> </field>
>
> </form>
> </formset>
> Even if all values are integer, it will fail validation regardless. According to http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt#18 I should
> do something like:
>
> <field property="types" indexedListProperty="types" depends="integer">
> <arg0 key="text.validation.type"/>
> </field>
>
> This time, it does indeed check all the values are of type integer, however,
> if you do not select anything (the field is not required) the result is:
>
> java.lang.NullPointerException
> org.apache.commons.validator.Field.getIndexedProperty(Field.java:796)
> org.apache.commons.validator.Field.validate(Field.java:891)
> ..
> Also having scoured all documentation in current and future builds and there is no example of validating an integer array.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Commented: (STR-2880) Validating integer arrays
Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/struts/browse/STR-2880?page=comments#action_37415 ]
Niall Pemberton commented on STR-2880:
--------------------------------------
Firstly the only way to resolve this currently is to ensure that your "types" property returns a zero length array rather than null.
I agree this looks like a bug - but it should be filed against Commons Validator rather than Struts. I'll try to find out if I can move this to Jakarta Commons (doesn't look like we can at the moment) - if not it will need to be closed and a new issue created for Commons Validator:
http://jakarta.apache.org/commons/validator/issue-tracking.html
> Validating integer arrays
> -------------------------
>
> Key: STR-2880
> URL: http://issues.apache.org/struts/browse/STR-2880
> Project: Struts Action 1
> Type: Bug
> Components: Unknown
> Versions: 1.2 Family
> Reporter: thomas bailey
>
> There seems to be some issue with validating integer arrays:
> html:
> <html:select property="types" multiple="true" size="3" >
> <html:option value="1">should work</html:option>
> <html:option value="2">should work as well</html:option>
> <html:option value="blah">this will fail validation</html:option>
> </html:select>
> actionform:
> public class PropertyFilter implements Serializable
> {
> private String[] types;
>
> public String[] getTypes() {
> return types;
> }
> public void setTypes(String[] types) {
> this.types = types;
> }
> }
> validation.xml:
>
> <formset>
> <form name="PropertyFilterForm">
>
> <field property="types" depends="integer">
> <arg0 key="text.validation.type"/>
> </field>
>
> </form>
> </formset>
> Even if all values are integer, it will fail validation regardless. According to http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt#18 I should
> do something like:
>
> <field property="types" indexedListProperty="types" depends="integer">
> <arg0 key="text.validation.type"/>
> </field>
>
> This time, it does indeed check all the values are of type integer, however,
> if you do not select anything (the field is not required) the result is:
>
> java.lang.NullPointerException
> org.apache.commons.validator.Field.getIndexedProperty(Field.java:796)
> org.apache.commons.validator.Field.validate(Field.java:891)
> ..
> Also having scoured all documentation in current and future builds and there is no example of validating an integer array.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Resolved: (STR-2880) Validating integer arrays
Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/struts/browse/STR-2880?page=all ]
Niall Pemberton resolved STR-2880:
----------------------------------
Resolution: Not A Problem
Assign To: Niall Pemberton
This isn't a Struts issue, its a Commons Validator problem.
See http://issues.apache.org/jira/browse/VALIDATOR-189
> Validating integer arrays
> -------------------------
>
> Key: STR-2880
> URL: http://issues.apache.org/struts/browse/STR-2880
> Project: Struts Action 1
> Type: Bug
> Components: Unknown
> Versions: 1.2 Family
> Reporter: thomas bailey
> Assignee: Niall Pemberton
>
> There seems to be some issue with validating integer arrays:
> html:
> <html:select property="types" multiple="true" size="3" >
> <html:option value="1">should work</html:option>
> <html:option value="2">should work as well</html:option>
> <html:option value="blah">this will fail validation</html:option>
> </html:select>
> actionform:
> public class PropertyFilter implements Serializable
> {
> private String[] types;
>
> public String[] getTypes() {
> return types;
> }
> public void setTypes(String[] types) {
> this.types = types;
> }
> }
> validation.xml:
>
> <formset>
> <form name="PropertyFilterForm">
>
> <field property="types" depends="integer">
> <arg0 key="text.validation.type"/>
> </field>
>
> </form>
> </formset>
> Even if all values are integer, it will fail validation regardless. According to http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt#18 I should
> do something like:
>
> <field property="types" indexedListProperty="types" depends="integer">
> <arg0 key="text.validation.type"/>
> </field>
>
> This time, it does indeed check all the values are of type integer, however,
> if you do not select anything (the field is not required) the result is:
>
> java.lang.NullPointerException
> org.apache.commons.validator.Field.getIndexedProperty(Field.java:796)
> org.apache.commons.validator.Field.validate(Field.java:891)
> ..
> Also having scoured all documentation in current and future builds and there is no example of validating an integer array.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Updated: (STR-2880) Validating integer arrays
Posted by "thomas bailey (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/struts/browse/STR-2880?page=all ]
thomas bailey updated STR-2880:
-------------------------------
Summary: Validating integer arrays (was: Validating array integers)
Description:
There seems to be some issue with validating integer arrays:
html:
<html:select property="types" multiple="true" size="3" >
<html:option value="1">should work</html:option>
<html:option value="2">should work as well</html:option>
<html:option value="blah">this will fail validation</html:option>
</html:select>
actionform:
public class PropertyFilter implements Serializable
{
private String[] types;
public String[] getTypes() {
return types;
}
public void setTypes(String[] types) {
this.types = types;
}
}
validation.xml:
<formset>
<form name="PropertyFilterForm">
<field property="types" depends="integer">
<arg0 key="text.validation.type"/>
</field>
</form>
</formset>
Even if all values are integer, it will fail validation regardless. According to http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt#18 I should
do something like:
<field property="types" indexedListProperty="types" depends="integer">
<arg0 key="text.validation.type"/>
</field>
This time, it does indeed check all the values are of type integer, however,
if you do not select anything (the field is not required) the result is:
java.lang.NullPointerException
org.apache.commons.validator.Field.getIndexedProperty(Field.java:796)
org.apache.commons.validator.Field.validate(Field.java:891)
..
Also having scoured all documentation in current and future builds and there is no example of validating an integer array.
was:
There seems to be some issue with validating arrays on integers:
html:
<html:select property="types" multiple="true" size="3" >
<html:option value="1">should work</html:option>
<html:option value="2">should work as well</html:option>
<html:option value="blah">this will fail validation</html:option>
</html:select>
actionform:
public class PropertyFilter implements Serializable
{
private String[] types;
public String[] getTypes() {
return types;
}
public void setTypes(String[] types) {
this.types = types;
}
}
validation.xml:
<formset>
<form name="PropertyFilterForm">
<field property="types" depends="integer">
<arg0 key="text.validation.type"/>
</field>
</form>
</formset>
Even if all values are integer, it will fail validation regardless. According to http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt#18 I should
do something like:
<field property="types" indexedListProperty="types" depends="integer">
<arg0 key="text.validation.type"/>
</field>
This time, it does indeed check all the values are of type integer, however,
if you do not select anything (the field is not required) the result is:
java.lang.NullPointerException
org.apache.commons.validator.Field.getIndexedProperty(Field.java:796)
org.apache.commons.validator.Field.validate(Field.java:891)
..
Also having scoured all documentation in current and future builds and there is no example of validating an integer array.
> Validating integer arrays
> -------------------------
>
> Key: STR-2880
> URL: http://issues.apache.org/struts/browse/STR-2880
> Project: Struts Action 1
> Type: Bug
> Components: Unknown
> Versions: 1.2 Family
> Reporter: thomas bailey
>
> There seems to be some issue with validating integer arrays:
> html:
> <html:select property="types" multiple="true" size="3" >
> <html:option value="1">should work</html:option>
> <html:option value="2">should work as well</html:option>
> <html:option value="blah">this will fail validation</html:option>
> </html:select>
> actionform:
> public class PropertyFilter implements Serializable
> {
> private String[] types;
>
> public String[] getTypes() {
> return types;
> }
> public void setTypes(String[] types) {
> this.types = types;
> }
> }
> validation.xml:
>
> <formset>
> <form name="PropertyFilterForm">
>
> <field property="types" depends="integer">
> <arg0 key="text.validation.type"/>
> </field>
>
> </form>
> </formset>
> Even if all values are integer, it will fail validation regardless. According to http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt#18 I should
> do something like:
>
> <field property="types" indexedListProperty="types" depends="integer">
> <arg0 key="text.validation.type"/>
> </field>
>
> This time, it does indeed check all the values are of type integer, however,
> if you do not select anything (the field is not required) the result is:
>
> java.lang.NullPointerException
> org.apache.commons.validator.Field.getIndexedProperty(Field.java:796)
> org.apache.commons.validator.Field.validate(Field.java:891)
> ..
> Also having scoured all documentation in current and future builds and there is no example of validating an integer array.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Updated: (STR-2880) Validating array integers
Posted by "thomas bailey (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/struts/browse/STR-2880?page=all ]
thomas bailey updated STR-2880:
-------------------------------
Description:
There seems to be some issue with validating arrays on integers:
html:
<html:select property="types" multiple="true" size="3" >
<html:option value="1">should work</html:option>
<html:option value="2">should work as well</html:option>
<html:option value="blah">this will fail validation</html:option>
</html:select>
actionform:
public class PropertyFilter implements Serializable
{
private String[] types;
public String[] getTypes() {
return types;
}
public void setTypes(String[] types) {
this.types = types;
}
}
validation.xml:
<formset>
<form name="PropertyFilterForm">
<field property="types" depends="integer">
<arg0 key="text.validation.type"/>
</field>
</form>
</formset>
Even if all values are integer, it will fail validation regardless. According to http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt#18 I should
do something like:
<field property="types" indexedListProperty="types" depends="integer">
<arg0 key="text.validation.type"/>
</field>
This time, it does indeed check all the values are of type integer, however,
if you do not select anything (the field is not required) the result is:
java.lang.NullPointerException
org.apache.commons.validator.Field.getIndexedProperty(Field.java:796)
org.apache.commons.validator.Field.validate(Field.java:891)
..
Also having scoured all documentation in current and future builds and there is no example of validating an integer array.
was:
html:
<html:select property="types" multiple="true" size="3" >
<html:option value="1">should work</html:option>
<html:option value="2">should work as well</html:option>
<html:option value="blah">this will fail validation</html:option>
</html:select>
actionform:
public class PropertyFilter implements Serializable
{
private String[] types;
public String[] getTypes() {
return types;
}
public void setTypes(String[] types) {
this.types = types;
}
}
validation.xml:
<formset>
<form name="PropertyFilterForm">
<field property="types" depends="integer">
<arg0 key="text.validation.type"/>
</field>
</form>
</formset>
Even if all values are integer, it will fail validation regardless. According to http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt#18 I should
do something like:
<field property="types" indexedListProperty="types" depends="integer">
<arg0 key="text.validation.type"/>
</field>
This time, it does indeed check all the values are of type integer, however,
if you do not select anything (the field is not required) the result is:
java.lang.NullPointerException
org.apache.commons.validator.Field.getIndexedProperty(Field.java:796)
org.apache.commons.validator.Field.validate(Field.java:891)
..
Also having scoured all documentation in current and future builds and there is no example of validating an integer array.
> Validating array integers
> -------------------------
>
> Key: STR-2880
> URL: http://issues.apache.org/struts/browse/STR-2880
> Project: Struts Action 1
> Type: Bug
> Components: Unknown
> Versions: 1.2 Family
> Reporter: thomas bailey
>
> There seems to be some issue with validating arrays on integers:
> html:
> <html:select property="types" multiple="true" size="3" >
> <html:option value="1">should work</html:option>
> <html:option value="2">should work as well</html:option>
> <html:option value="blah">this will fail validation</html:option>
> </html:select>
> actionform:
> public class PropertyFilter implements Serializable
> {
> private String[] types;
>
> public String[] getTypes() {
> return types;
> }
> public void setTypes(String[] types) {
> this.types = types;
> }
> }
> validation.xml:
>
> <formset>
> <form name="PropertyFilterForm">
>
> <field property="types" depends="integer">
> <arg0 key="text.validation.type"/>
> </field>
>
> </form>
> </formset>
> Even if all values are integer, it will fail validation regardless. According to http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt#18 I should
> do something like:
>
> <field property="types" indexedListProperty="types" depends="integer">
> <arg0 key="text.validation.type"/>
> </field>
>
> This time, it does indeed check all the values are of type integer, however,
> if you do not select anything (the field is not required) the result is:
>
> java.lang.NullPointerException
> org.apache.commons.validator.Field.getIndexedProperty(Field.java:796)
> org.apache.commons.validator.Field.validate(Field.java:891)
> ..
> Also having scoured all documentation in current and future builds and there is no example of validating an integer array.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Resolved: (STR-2880) Validating integer arrays
Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/struts/browse/STR-2880?page=all ]
Niall Pemberton resolved STR-2880:
----------------------------------
Resolution: Not A Problem
Assign To: Niall Pemberton
This isn't a Struts issue, its a Commons Validator problem.
See http://issues.apache.org/jira/browse/VALIDATOR-189
> Validating integer arrays
> -------------------------
>
> Key: STR-2880
> URL: http://issues.apache.org/struts/browse/STR-2880
> Project: Struts Action 1
> Type: Bug
> Components: Unknown
> Versions: 1.2 Family
> Reporter: thomas bailey
> Assignee: Niall Pemberton
>
> There seems to be some issue with validating integer arrays:
> html:
> <html:select property="types" multiple="true" size="3" >
> <html:option value="1">should work</html:option>
> <html:option value="2">should work as well</html:option>
> <html:option value="blah">this will fail validation</html:option>
> </html:select>
> actionform:
> public class PropertyFilter implements Serializable
> {
> private String[] types;
>
> public String[] getTypes() {
> return types;
> }
> public void setTypes(String[] types) {
> this.types = types;
> }
> }
> validation.xml:
>
> <formset>
> <form name="PropertyFilterForm">
>
> <field property="types" depends="integer">
> <arg0 key="text.validation.type"/>
> </field>
>
> </form>
> </formset>
> Even if all values are integer, it will fail validation regardless. According to http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt#18 I should
> do something like:
>
> <field property="types" indexedListProperty="types" depends="integer">
> <arg0 key="text.validation.type"/>
> </field>
>
> This time, it does indeed check all the values are of type integer, however,
> if you do not select anything (the field is not required) the result is:
>
> java.lang.NullPointerException
> org.apache.commons.validator.Field.getIndexedProperty(Field.java:796)
> org.apache.commons.validator.Field.validate(Field.java:891)
> ..
> Also having scoured all documentation in current and future builds and there is no example of validating an integer array.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Updated: (STR-2880) Validating integer arrays
Posted by "thomas bailey (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/struts/browse/STR-2880?page=all ]
thomas bailey updated STR-2880:
-------------------------------
Summary: Validating integer arrays (was: Validating array integers)
Description:
There seems to be some issue with validating integer arrays:
html:
<html:select property="types" multiple="true" size="3" >
<html:option value="1">should work</html:option>
<html:option value="2">should work as well</html:option>
<html:option value="blah">this will fail validation</html:option>
</html:select>
actionform:
public class PropertyFilter implements Serializable
{
private String[] types;
public String[] getTypes() {
return types;
}
public void setTypes(String[] types) {
this.types = types;
}
}
validation.xml:
<formset>
<form name="PropertyFilterForm">
<field property="types" depends="integer">
<arg0 key="text.validation.type"/>
</field>
</form>
</formset>
Even if all values are integer, it will fail validation regardless. According to http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt#18 I should
do something like:
<field property="types" indexedListProperty="types" depends="integer">
<arg0 key="text.validation.type"/>
</field>
This time, it does indeed check all the values are of type integer, however,
if you do not select anything (the field is not required) the result is:
java.lang.NullPointerException
org.apache.commons.validator.Field.getIndexedProperty(Field.java:796)
org.apache.commons.validator.Field.validate(Field.java:891)
..
Also having scoured all documentation in current and future builds and there is no example of validating an integer array.
was:
There seems to be some issue with validating arrays on integers:
html:
<html:select property="types" multiple="true" size="3" >
<html:option value="1">should work</html:option>
<html:option value="2">should work as well</html:option>
<html:option value="blah">this will fail validation</html:option>
</html:select>
actionform:
public class PropertyFilter implements Serializable
{
private String[] types;
public String[] getTypes() {
return types;
}
public void setTypes(String[] types) {
this.types = types;
}
}
validation.xml:
<formset>
<form name="PropertyFilterForm">
<field property="types" depends="integer">
<arg0 key="text.validation.type"/>
</field>
</form>
</formset>
Even if all values are integer, it will fail validation regardless. According to http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt#18 I should
do something like:
<field property="types" indexedListProperty="types" depends="integer">
<arg0 key="text.validation.type"/>
</field>
This time, it does indeed check all the values are of type integer, however,
if you do not select anything (the field is not required) the result is:
java.lang.NullPointerException
org.apache.commons.validator.Field.getIndexedProperty(Field.java:796)
org.apache.commons.validator.Field.validate(Field.java:891)
..
Also having scoured all documentation in current and future builds and there is no example of validating an integer array.
> Validating integer arrays
> -------------------------
>
> Key: STR-2880
> URL: http://issues.apache.org/struts/browse/STR-2880
> Project: Struts Action 1
> Type: Bug
> Components: Unknown
> Versions: 1.2 Family
> Reporter: thomas bailey
>
> There seems to be some issue with validating integer arrays:
> html:
> <html:select property="types" multiple="true" size="3" >
> <html:option value="1">should work</html:option>
> <html:option value="2">should work as well</html:option>
> <html:option value="blah">this will fail validation</html:option>
> </html:select>
> actionform:
> public class PropertyFilter implements Serializable
> {
> private String[] types;
>
> public String[] getTypes() {
> return types;
> }
> public void setTypes(String[] types) {
> this.types = types;
> }
> }
> validation.xml:
>
> <formset>
> <form name="PropertyFilterForm">
>
> <field property="types" depends="integer">
> <arg0 key="text.validation.type"/>
> </field>
>
> </form>
> </formset>
> Even if all values are integer, it will fail validation regardless. According to http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt#18 I should
> do something like:
>
> <field property="types" indexedListProperty="types" depends="integer">
> <arg0 key="text.validation.type"/>
> </field>
>
> This time, it does indeed check all the values are of type integer, however,
> if you do not select anything (the field is not required) the result is:
>
> java.lang.NullPointerException
> org.apache.commons.validator.Field.getIndexedProperty(Field.java:796)
> org.apache.commons.validator.Field.validate(Field.java:891)
> ..
> Also having scoured all documentation in current and future builds and there is no example of validating an integer array.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira