Create a IntegerItem field:
enter value like 001, 01 and so on.
Try to get the value as Integer:
The returned value is null. I created the fix:
This fixes the issue, but I think this should be fixed in the sgwt code.
SmartClient Version: v10.1p_2016-08-05/PowerEdition Deployment (built 2016-08-05)
Code:
private final IntegerItem maximumPasswordAge = new IntegerItem();
Try to get the value as Integer:
Code:
Integer value = maximumPasswordAge.getValueAsInteger();
Code:
/** * Ensure that none of the IntegerItem fields returns null from the getValueAsInteger - this can be the case if * the number has leading zeros for example: 001 will returns null, not 1. * * [USER="45788"]param[/USER] field to process the int * @return integer evaluated by parsing */ private Integer getIntegerFromIntegerItem( final IntegerItem field ) { Integer result = field.getValueAsInteger(); if ( result == null ) { [B] String stringValue = field.getValueAsString();[/B] try { [B]result = Integer.parseInt( stringValue );[/B] if ( result != null ) { // do not leave value which can not be processed by the IntegerItem field.setValue( result ); } } catch ( NumberFormatException ignore ) { // should never be here, because the function invoked after validation result = null; } } return result; } Integer value = getIntegerFromIntegerItem(maximumPasswordAge);
SmartClient Version: v10.1p_2016-08-05/PowerEdition Deployment (built 2016-08-05)
Comment