[jboss-jira] [JBoss JIRA] Created: (JBCOMMON-26) Error handling in property editors for null values

Adrian Brock (JIRA) jira-events at lists.jboss.org
Tue Jun 19 09:19:28 EDT 2007


Error handling in property editors for null values
--------------------------------------------------

                 Key: JBCOMMON-26
                 URL: http://jira.jboss.com/jira/browse/JBCOMMON-26
             Project: JBoss Common
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: common-old, core
            Reporter: Adrian Brock


As per the parent task, the error handling for the DateEditor is not handling null values correctly.

   public void setValue(Object value)
   {
      if (value instanceof Date)
      {
         text = null;
         super.setValue(value);
      }
      else
      {
         throw new IllegalArgumentException("setValue() expected java.util.Date value, got "
               + value.getClass().getName());
      }
   }

There needs to be an initial
if (value == null)
   throw new IllegalArgumentException("Null value for setValue() expected java.util.Date");

or alternatively (since the javadocs don't disallow null values)
if (value == null)
   return null;

The other property editors need checking for the same problem.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list