[jboss-jira] [JBoss JIRA] Created: (JBPORTAL-2199) Modify "Property not found" exception in DynamicUserAttribute to include the property name

Stephen Houston (JIRA) jira-events at lists.jboss.org
Wed Oct 15 05:52:21 EDT 2008


Modify "Property not found" exception in DynamicUserAttribute to include the property name
------------------------------------------------------------------------------------------

                 Key: JBPORTAL-2199
                 URL: https://jira.jboss.org/jira/browse/JBPORTAL-2199
             Project: JBoss Portal
          Issue Type: Feature Request
      Security Level: Public (Everyone can see)
          Components: Portal Identity
    Affects Versions: 2.6.6 Final
            Reporter: Stephen Houston


DynamicUserAttribute.getType catches exceptions from IdentityUserBean.getPropertyType, however it does not include the property name on the new IllegalArgumentException that it throws. This is unhelpful for developers trying to debug the issue.

Suggest changing

   public Class getType(Object propertyName) throws IllegalArgumentException
   {
      try
      {
         return identityUserBean.getPropertyType((String) propertyName);
      }
      catch (Exception e)
      {
         e.printStackTrace();
         throw new IllegalArgumentException("Property not found.");
      }
   }

to

   public Class getType(Object propertyName) throws IllegalArgumentException
   {
      try
      {
         return identityUserBean.getPropertyType((String) propertyName);
      }
      catch (Exception e)
      {
         throw new IllegalArgumentException("Property not found - " + propertyName, 
        		 e);
      }
   }

Note that this also moves the caught exception to be the cause of the IllegalArgumentException instead of just printing out the stack trace. This allows callers to determine how they want to handle the root cause as opposed to forcing that just a stack trace is written (and forcing where the trace is written).

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

        



More information about the jboss-jira mailing list