Im having this error whenever I enter an empty string in the textbox and try to save it Im having this error:

Failed to convert property value of type java.lang.String to 
   required type double for property customerAcctSetting.maxAllowableAmount; 
nested exception is java.lang.IllegalArgumentException: Cannot convert value of 
    type [java.lang.String] to required type [double] for 
    property maxAllowableAmount:
PropertyEditor [bp.ar.util.NumberFormatUtil$CustomerDoubleEditor] returned
    inappropriate value

But when I enter an invalid number format such as "ddd" I have this error:

Failed to convert property value of type java.lang.String to required
    type double for property customerAcctSetting.maxAllowableAmount; 
nested exception is java.lang.NumberFormatException: For input string: "ddd"

I have this binder in my controller:

@InitBinder
public void initBinder(WebDataBinder binder) {
    NumberFormatUtil.registerDoubleFormat(binder);
}

And I have a class NumberFormatUtil.java that implements the static function registerDoubleFormat(binder):

NumberFormatUtil.java

public static void registerDoubleFormat (WebDataBinder binder) {
    binder.registerCustomEditor(Double.TYPE, new CustomerDoubleEditor());
}

private static class CustomerDoubleEditor extends PropertyEditorSupport{    
    public String getAsText() { 
        Double d = (Double) getValue(); 
        return d.toString(); 
    } 

    public void setAsText(String str) { 
        if( str == "" || str == null ) 
            setValue(0); 
        else 
            setValue(Double.parseDouble(str)); 
    } 
}

Im using Spring 3.0.1. Im very new to java and other related technologies such as spring. Please help. Thanks in advance.

Edit
Report