[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-2551) NPE in Support Services NPE in Param.validateConvertedValue

Joshua Davis (JIRA) jira-events at lists.jboss.org
Tue Jan 29 07:09:01 EST 2008

NPE in Support Services NPE in Param.validateConvertedValue

                 Key: JBSEAM-2551
                 URL: http://jira.jboss.com/jira/browse/JBSEAM-2551
             Project: JBoss Seam
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.0.0.GA
         Environment: jdk1.5.0_12, JBoss 4.2.2.GA, Linux
            Reporter: Joshua Davis

I've been getting null pointer exceptions with Seam 2.0.0.GA with a .page.xml file / application that used to work fine in 1.2.1.GA. The error happens when processing the restful parameters: 
2008-01-23 14:44:57,532 [http-] ERROR SeamPhaseListener  - uncaught exception
	at org.jboss.seam.navigation.Param.validateConvertedValue(Param.java:246)
	at org.jboss.seam.navigation.Pages.convertAndValidateStringValuesInPageContext(Pages.java:743)
	at org.jboss.seam.navigation.Pages.postRestore(Pages.java:393)

This is the code in Param.java that fails: 
      if (valueExpression!=null)
         //TODO: note that this code is duplicated from ModelValidator!!
         ELContext elContext = facesContext.getELContext();
         InvalidValue[] invalidValues;
            invalidValues = Validators.instance().validate( valueExpression.toUnifiedValueExpression
(), elContext, value );
         catch (ELException ele)
            Throwable cause = ele.getCause();
            if (cause==null) cause = ele;
            throw new ValidatorException( createMessage(cause), cause );
         if ( invalidValues.length>0 ) // <== Boom! NPE
            throw new ValidatorException( createMessage(invalidValues) );

I took a look at the code and saw that there is an array of 'invalid values' which is expected to be of zero length if there are no errors but in this case it's null. The strange thing is that there are other places in the application where restful parameters work just fine. The only thing I can think of is that in this case, the restful parameter is being used inside a facelets template (the parameter turns the top nav bar off). 

I fixed the bug by adding:

 invalidValues = new InvalidValue[0];

To the constructor of ValidatingResolver inside Validators.java.

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