Uploaded image for project: 'Seam 2'
  1. Seam 2
  2. JBSEAM-2551

NPE in Support Services NPE in Param.validateConvertedValue

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.0.GA
    • Fix Version/s: The future
    • Component/s: Core
    • Labels:
      None
    • Environment:

      jdk1.5.0_12, JBoss 4.2.2.GA, Linux

      Description

      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).

      I fixed the bug by adding:

      invalidValues = new InvalidValue[0];

      To the constructor of ValidatingResolver inside Validators.java.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                pgmjsd Joshua Davis
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated: