Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.27, 2.2.5
    • Fix Version/s: 2.2.6
    • Component/s: None
    • Labels:
      None

      Description

      Very minor problem, but easy to fix.

      If a custom UIComponent renders itself it's common to return null in the getFamily() method. One example in "JSF Complete Reference" book suggests to do just that on page 308. The API does not say it is prohibited either.

      The FormOmittedChecker#isForm method does not check for null in
      component.getFamily().endsWith("Form")
      which may lead to a NPE.

      A workaround is to return an empty string in the component's getFamily() method.

        Issue Links

          Activity

          Hide
          Ed Burns added a comment -

          Thanks for referencing the book. While the book does say:

          The simple HtmlHelloWorld example doesn’t create a new family of components and renderers, so it can just return a null value for now.

          The spec API Javadoc says:

          Return the identifier of the component family to which this component belongs. This identifier, in conjunction with the value of the rendererType property, may be used to select the appropriate Renderer for this component instance.

          In cases like this we must decide in favor of the spec API Javadoc. I have created https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1267. In the meantime, Manfred will put in the null check and return false.

          Show
          Ed Burns added a comment - Thanks for referencing the book. While the book does say: The simple HtmlHelloWorld example doesn’t create a new family of components and renderers, so it can just return a null value for now. The spec API Javadoc says: Return the identifier of the component family to which this component belongs. This identifier, in conjunction with the value of the rendererType property, may be used to select the appropriate Renderer for this component instance. In cases like this we must decide in favor of the spec API Javadoc. I have created https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1267 . In the meantime, Manfred will put in the null check and return false.
          Hide
          frederickkaempfer added a comment -

          Thanks. I agree that it needs clarifying in the spec. It was just something I stumbled upon while re-reading the book. And the stacktrace you get is not very conclusive.

          Show
          frederickkaempfer added a comment - Thanks. I agree that it needs clarifying in the spec. It was just something I stumbled upon while re-reading the book. And the stacktrace you get is not very conclusive.
          Hide
          Manfred Riem added a comment -

          Applied to 2.2 branch,

          svn commit -m "Fixes https://java.net/jira/browse/JAVASERVERFACES-3180, make sure we guard against null from getFamily method."
          Sending jsf-ri/src/main/java/com/sun/faces/application/view/FormOmittedChecker.java
          Transmitting file data .
          Committed revision 12866.

          Show
          Manfred Riem added a comment - Applied to 2.2 branch, svn commit -m "Fixes https://java.net/jira/browse/JAVASERVERFACES-3180 , make sure we guard against null from getFamily method." Sending jsf-ri/src/main/java/com/sun/faces/application/view/FormOmittedChecker.java Transmitting file data . Committed revision 12866.

            People

            • Assignee:
              Manfred Riem
              Reporter:
              frederickkaempfer
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: