[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-665) Seam throws NPE when a component with a @Name is specified in components.xml

Mike Quilleash (JIRA) jira-events at jboss.com
Wed Jan 17 07:45:52 EST 2007


Seam throws NPE when a component with a @Name is specified in components.xml
----------------------------------------------------------------------------

                 Key: JBSEAM-665
                 URL: http://jira.jboss.com/jira/browse/JBSEAM-665
             Project: JBoss Seam
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.1.0.GA
         Environment: Win XP Pro
Java 1.5.0
Tomcat 6.0.7
            Reporter: Mike Quilleash


Example line in components.xml

  <component class="com.xxx.ElementDetail"/>

Class ElementDetail does not have a @Name (which it should) but class Initialization method installComponentFromXmlElement() throws an NPE on this line.

  name = clazz.getAnnotation(Name.class).value();

Would be nice to check for the null condition and throw a more descriptive exception of the problem. e.g

Name nameAnnotation = clazz.getAnnotation( Name.class );
if ( nameAnnotation == null )
    throw new IllegalArgumentException( "Component class " + class.getName() + " requires a @Name annotation or it's components.xml reference requires a name attribute" );
name = nameAnnotation.value();



-- 
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 seam-issues mailing list