title: Failed to convert property value of type java.lang.String to required type double
body: <p>Im having this error whenever I enter an empty string in the textbox and try to save it Im having this error:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>But when I enter an invalid number format such as "ddd" I have this error:</p>
  
  <pre><code>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"
  </code></pre>
  
  <p>I have this binder in my controller:</p>
  
  <pre><code>@InitBinder
  public void initBinder(WebDataBinder binder) {
      NumberFormatUtil.registerDoubleFormat(binder);
  }
  </code></pre>
  
  <p>And I have a class <code>NumberFormatUtil.java</code> that implements the static function <code>registerDoubleFormat(binder)</code>:</p>
  
  <p><b><code>NumberFormatUtil.java</code></b></p>
  
  <pre><code>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)); 
      } 
  }
  </code></pre>
  
  <p>Im using Spring 3.0.1. Im very new to java and other related technologies such as spring. Please help. Thanks in advance.</p>