ICEfaces
  1. ICEfaces
  2. ICE-9963

ace:dataTable - ArithmeticException thrown when displaying 'ALL' records

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-3.3.0.GA_P01, 4.0.BETA
    • Fix Version/s: EE-3.3.0.GA_P02, 4.0
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      All

      Description

      If an ace:dataTable is set to be lazily initialized and it also has the rowsPerPageTemplate set to include values in addition to 'ALL', selecting the 'ALL' option causes an ArithmeticException: / by zero exception to be thrown. It seems the ALL option is returning 0 as the page size.

      If this is the expected behavior then this should be documented where it is not possible to use the 'ALL' rows per page option.

      java.lang.ArithmeticException: / by zero
      at org.icefaces.ace.model.table.LazyDataModel.setRowIndex(LazyDataModel.java:73)
      at javax.faces.component.UIData.setRowIndexWithoutRowStatePreserved(UIData.java:484)
      at javax.faces.component.UIData.setRowIndex(UIData.java:472)
      at org.icefaces.ace.component.datatable.DataTable.setRowIndex(DataTable.java:496)
      at org.icefaces.ace.component.datatable.DataTable.visitTree(DataTable.java:1608)
      at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663)
      at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663)
      at javax.faces.component.UIForm.visitTree(UIForm.java:371)
      at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663)
      at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663)
      at org.icefaces.impl.context.DOMPartialViewContext.renderSubtrees(DOMPartialViewContext.java:459)
      at org.icefaces.impl.context.DOMPartialViewContext.processPartial(DOMPartialViewContext.java:170)
      at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:973)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1819)
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:421)
      at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)
      at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:286)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
      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.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
      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:1004)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:744)

        Activity

        Hide
        Arran Mccullough added a comment -

        Attached test case that shows the issue. The icefaces, icefaces-ace, and icefaces-compat jar files need to be added back into the war to run.

        Steps:

        • Load welcomeICEfaces.jsf
        • Select the ALL option from the drop down list. Error is thrown.
        Show
        Arran Mccullough added a comment - Attached test case that shows the issue. The icefaces, icefaces-ace, and icefaces-compat jar files need to be added back into the war to run. Steps: Load welcomeICEfaces.jsf Select the ALL option from the drop down list. Error is thrown.
        Hide
        Arturo Zambrano added a comment -

        Committed fix to prevent division by zero when showing all records in lazy mode (i.e. pageSize = 0) to 4.0 trunk at revision 40807 and to 3.3 EE maintenance branch at revision 40808.

        Note: In order to work properly, this test case will have to be modified. The last line of the load() method should be changed to the following:

        		if (pageSize > 0) return this.dataSource.subList(first, Math.min(first + pageSize, this.getRowCount() - 1));
        		else return this.dataSource;
        

        This covers the case when pageSize = 0, which means that all records should be shown. This fact will be thoroughly documented as part of ICE-9900.

        Show
        Arturo Zambrano added a comment - Committed fix to prevent division by zero when showing all records in lazy mode (i.e. pageSize = 0) to 4.0 trunk at revision 40807 and to 3.3 EE maintenance branch at revision 40808. Note: In order to work properly, this test case will have to be modified. The last line of the load() method should be changed to the following: if (pageSize > 0) return this .dataSource.subList(first, Math .min(first + pageSize, this .getRowCount() - 1)); else return this .dataSource; This covers the case when pageSize = 0, which means that all records should be shown. This fact will be thoroughly documented as part of ICE-9900 .

          People

          • Assignee:
            Arturo Zambrano
            Reporter:
            Arran Mccullough
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: