[jboss-user] [JBoss Seam] - NPE in Param.validateConvertedValue

pgmjsd do-not-reply at jboss.com
Sun Jan 27 10:15:20 EST 2008


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-0.0.0.0-8080-1] ERROR SeamPhaseListener  - uncaught exception
  | java.lang.NullPointerException
  | 	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;
  |          try
  |          {
  |             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).

Anyone see this before?
I suppose I could fix it by overriding the definition of Validators with my own, or perhaps patching Param.



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4123857#4123857

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4123857



More information about the jboss-user mailing list