Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 3.1.0.BETA1, 3.1
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      IceFaces 3.0.0 JSF 2.1.4
    • Affects:
      Documentation (User Guide, Ref. Guide, etc.), Compatibility/Configuration
    • Workaround Exists:
      Yes
    • Workaround Description:
      Hide
      Change in DataTableRenderer at line 512 this
      if (table.getHeight() != Integer.MIN_VALUE) writer.write(",height:" + table.getHeight());
      to
      if (table.getHeight() != null && table.getHeight() != Integer.MIN_VALUE) writer.write(",height:" + table.getHeight());
      Show
      Change in DataTableRenderer at line 512 this if (table.getHeight() != Integer.MIN_VALUE) writer.write(",height:" + table.getHeight()); to if (table.getHeight() != null && table.getHeight() != Integer.MIN_VALUE) writer.write(",height:" + table.getHeight());

      Description

      Hi,

      I have this ace data table declaration in a page:

      <ace:dataTable
      id="someId"
      value="#{SomeBean.rows}"
      var="row"
      scrollable="true"
      scrollHeight="450px"
      rendered="#{SomeBean.renderCondition}"
      stateMap="#{SomeBean.rowStateMap}"
      selectionMode="single"
                      rowSelectListener="#{SomeBean.rowSelListener}"
                      rowUnselectListener="#{SomeBean.rowUnSelListener}"
                      >
      <ace:ajax event="select" />
      <ace:column>
      <h:outputText id="someId2" value="#{row.someProperty}" />
      </ace:column>
      </ace:dataTable>

      When I try to access the page I get this exception:

      java.lang.NullPointerException
              at org.icefaces.ace.component.datatable.DataTableRenderer.encodeScript(DataTableRenderer.java:512)
              at org.icefaces.ace.component.datatable.DataTableRenderer.encodeEntierty(DataTableRenderer.java:567)
              at org.icefaces.ace.component.datatable.DataTableRenderer.encodeEnd(DataTableRenderer.java:112)
              at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1763)
              at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
              at org.icefaces.impl.renderkit.RendererWrapper.encodeChildren(RendererWrapper.java:49)
              at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1756)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)
              at org.icefaces.impl.context.DOMPartialViewContext.processPartial(DOMPartialViewContext.java:146)
              at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:981)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1756)
              at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:390)
              at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
              at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
              at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
              at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
              at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
              at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
              at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1815)
              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
              at java.lang.Thread.run(Thread.java:662)

      I identified the problem in DataTableRenderer.java row 512: if (table.getHeight() != Integer.MIN_VALUE) writer.write(",height:" + table.getHeight());

      It appears that if getHeight returns null when java attempts an out boxing on null it throws a NPE

      You should check the components and renderers for similar issues.

      Thank you

        Activity

        Hide
        Nils Lundquist added a comment -

        This example uses the incorrect attribute to define height, resulting in a null pointer during the script creation for the scrollable table.

        <ace:dataTable
        id="someId"
        value="#

        {SomeBean.rows}"
        var="row"
        scrollable="true"
        scrollHeight="450px"
        rendered="#{SomeBean.renderCondition}"
        stateMap="#{SomeBean.rowStateMap}"
        selectionMode="single"
        rowSelectListener="#{SomeBean.rowSelListener}"
        rowUnselectListener="#{SomeBean.rowUnSelListener}"
        >
        <ace:ajax event="select" />
        <ace:column>
        <h:outputText id="someId2" value="#{row.someProperty}" />
        </ace:column>
        </ace:dataTable>

        changing 'scrollHeight' to 'height' will fix this issue.

        <ace:dataTable
        id="someId"
        value="#{SomeBean.rows}

        "
        var="row"
        scrollable="true"
        height="450"
        rendered="#

        {SomeBean.renderCondition}

        "
        stateMap="#

        {SomeBean.rowStateMap}

        "
        selectionMode="single"
        rowSelectListener="#

        {SomeBean.rowSelListener}

        "
        rowUnselectListener="#

        {SomeBean.rowUnSelListener}

        "
        >
        <ace:ajax event="select" />
        <ace:column>
        <h:outputText id="someId2" value="#

        {row.someProperty}

        " />
        </ace:column>
        </ace:dataTable>

        Show
        Nils Lundquist added a comment - This example uses the incorrect attribute to define height, resulting in a null pointer during the script creation for the scrollable table. <ace:dataTable id="someId" value="# {SomeBean.rows}" var="row" scrollable="true" scrollHeight="450px" rendered="#{SomeBean.renderCondition}" stateMap="#{SomeBean.rowStateMap}" selectionMode="single" rowSelectListener="#{SomeBean.rowSelListener}" rowUnselectListener="#{SomeBean.rowUnSelListener}" > <ace:ajax event="select" /> <ace:column> <h:outputText id="someId2" value="#{row.someProperty}" /> </ace:column> </ace:dataTable> changing 'scrollHeight' to 'height' will fix this issue. <ace:dataTable id="someId" value="#{SomeBean.rows} " var="row" scrollable="true" height="450" rendered="# {SomeBean.renderCondition} " stateMap="# {SomeBean.rowStateMap} " selectionMode="single" rowSelectListener="# {SomeBean.rowSelListener} " rowUnselectListener="# {SomeBean.rowUnSelListener} " > <ace:ajax event="select" /> <ace:column> <h:outputText id="someId2" value="# {row.someProperty} " /> </ace:column> </ace:dataTable>
        Hide
        Nils Lundquist added a comment - - edited

        I'd like to note that we've decided in future versions the 'height' attribute will be functional but deprecated, and an attribute named 'scrollHeight' will supersede it. ScrollHeight will also have a default height of 100px to avoid this NPE.

        Show
        Nils Lundquist added a comment - - edited I'd like to note that we've decided in future versions the 'height' attribute will be functional but deprecated, and an attribute named 'scrollHeight' will supersede it. ScrollHeight will also have a default height of 100px to avoid this NPE.
        Hide
        Ioan Berciu added a comment -

        Hi,

        Thank you, for your answer.

        Even though I mixed attribute from ice:dataTabel with attributes from ace:dataTable when porting from version 1.8 ice component to 3.0.0 ace component
        IceFaces should fall back gracefully not with NPE in future versions.

        Thank you

        Show
        Ioan Berciu added a comment - Hi, Thank you, for your answer. Even though I mixed attribute from ice:dataTabel with attributes from ace:dataTable when porting from version 1.8 ice component to 3.0.0 ace component IceFaces should fall back gracefully not with NPE in future versions. Thank you

          People

          • Assignee:
            Nils Lundquist
            Reporter:
            Ioan Berciu
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: