javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-2351

NullPointerException in case value of outputFormat resolved to null

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.4
    • Fix Version/s: 2.1.9, 2.2.0-m03
    • Component/s: None
    • Labels:
      None
    • Environment:

      JBoss AS 7.1.0.Final, JSF 2.1.5

      Description

      In case of value of outputFormat component resolved to 'null' - runtime NPE is thrown. E.g. the following causes the issue:
      <h:outputFormat />
      <h:outputFormat value="#

      {null}

      "/>
      <h:outputFormat value="#

      {bean.somethingMayBeNull}

      "/>

      Prior to 2.1.4 OutputMessageRenderer handled 'null' value like this:

      Object currentObj = ((ValueHolder) component).getValue();
      String currentValue;
      if (currentObj != null)

      { currentValue = currentObj.toString(); }

      else

      { // if the value is null, do not output anything. return; }

      And in 2.1.4 it was changed to (fix of http://java.net/jira/browse/JAVASERVERFACES-2111):
      String currentValue = getCurrentValue(context, component);

      Null-check of 'currentValue' seems to be missed.

      Stacktrace:
      java.lang.NullPointerException: Argument Error: Parameter text is null
      at com.sun.faces.renderkit.html_basic.HtmlResponseWriter.writeText(HtmlResponseWriter.java:877)
      at javax.faces.context.ResponseWriter.writeText(ResponseWriter.java:275)
      at com.sun.faces.renderkit.html_basic.OutputMessageRenderer.encodeEnd(OutputMessageRenderer.java:163)
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)

        Activity

        Hide
        rogerk added a comment -

        Changes.

        Show
        rogerk added a comment - Changes.
        Hide
        rogerk added a comment -

        Committed to MOJARAA_2_1X_ROLLING branch:
        Sending jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/OutputMessageRenderer.java
        Adding test/agnostic/renderKit/basic/src/main/java/com/sun/faces/test/agnostic/renderKit/basic/Bean.java
        Adding test/agnostic/renderKit/basic/src/main/webapp/outputFormat.xhtml
        Adding test/agnostic/renderKit/basic/src/test/java/com/sun/faces/test/agnostic/renderKit/basic/Issue2351IT.java
        Transmitting file data ....
        Committed revision 10019.

        Show
        rogerk added a comment - Committed to MOJARAA_2_1X_ROLLING branch: Sending jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/OutputMessageRenderer.java Adding test/agnostic/renderKit/basic/src/main/java/com/sun/faces/test/agnostic/renderKit/basic/Bean.java Adding test/agnostic/renderKit/basic/src/main/webapp/outputFormat.xhtml Adding test/agnostic/renderKit/basic/src/test/java/com/sun/faces/test/agnostic/renderKit/basic/Issue2351IT.java Transmitting file data .... Committed revision 10019.
        Hide
        rogerk added a comment -

        trunk changes.

        Show
        rogerk added a comment - trunk changes.
        Hide
        rogerk added a comment -

        Committed to trunk:
        Sending jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/OutputMessageRenderer.java
        Adding test/agnostic/renderKit/basic/src/main/java/com/sun/faces/test/agnostic
        Adding test/agnostic/renderKit/basic/src/main/java/com/sun/faces/test/agnostic/renderKit
        Adding test/agnostic/renderKit/basic/src/main/java/com/sun/faces/test/agnostic/renderKit/basic
        Adding test/agnostic/renderKit/basic/src/main/java/com/sun/faces/test/agnostic/renderKit/basic/Bean.java
        Adding test/agnostic/renderKit/basic/src/main/webapp/outputFormat.xhtml
        Adding test/agnostic/renderKit/basic/src/test/java/com/sun/faces/test/agnostic/renderKit/basic/Issue2351IT.java
        Transmitting file data ....
        Committed revision 10020.

        Show
        rogerk added a comment - Committed to trunk: Sending jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/OutputMessageRenderer.java Adding test/agnostic/renderKit/basic/src/main/java/com/sun/faces/test/agnostic Adding test/agnostic/renderKit/basic/src/main/java/com/sun/faces/test/agnostic/renderKit Adding test/agnostic/renderKit/basic/src/main/java/com/sun/faces/test/agnostic/renderKit/basic Adding test/agnostic/renderKit/basic/src/main/java/com/sun/faces/test/agnostic/renderKit/basic/Bean.java Adding test/agnostic/renderKit/basic/src/main/webapp/outputFormat.xhtml Adding test/agnostic/renderKit/basic/src/test/java/com/sun/faces/test/agnostic/renderKit/basic/Issue2351IT.java Transmitting file data .... Committed revision 10020.
        Hide
        rogerk added a comment -

        Fix versions

        Show
        rogerk added a comment - Fix versions

          People

          • Assignee:
            rogerk
            Reporter:
            AndreyZ
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: