Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-10189

Comparator doesn't consider null values

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.0.0.Milestone5
    • Fix Version/s: 4.0.0.Milestone6
    • Component/s: component-tables
    • Labels:
      None
    • Environment:
    • Steps to Reproduce:
      Hide

      1. open http://localhost:8080/metamer/faces/components/richCollapsibleSubTable/sorting-using-column.xhtml
      2. click to Birthday column header link to sort the column
      FAIL: no data is displayed
      3. click to Refresh Full Page (image in header of page)
      FAIL: NullPointerException

      Show
      1. open http://localhost:8080/metamer/faces/components/richCollapsibleSubTable/sorting-using-column.xhtml 2. click to Birthday column header link to sort the column FAIL: no data is displayed 3. click to Refresh Full Page (image in header of page) FAIL: NullPointerException
    • Similar Issues:
      Show 10 results 

      Description

      See also [Steps to Reproduce] to reproduce it in Metamer.

      I have model which contains null values in one column and when I want to sort by such column, I want to let RichFaces consider it and sort it on the end of the.

      The java.lang.Comparable itself [1] states that the NullPointerException should be thrown when comparing object to null value.

      However for user convenience, it will be better to handle null values in consistent way to avoid necessity for defining custom comparator.

      [1] http://download.oracle.com/javase/6/docs/api/java/lang/Comparable.html

      java.lang.NullPointerException
      at java.util.Date.getMillisOf(Date.java:956)
      at java.util.Date.compareTo(Date.java:976)
      at java.util.Date.compareTo(Date.java:129)
      at org.richfaces.model.ArrangeableModel.compareSortByValues(ArrangeableModel.java:328)
      at org.richfaces.model.ArrangeableModel.compare(ArrangeableModel.java:309)
      at org.richfaces.model.ArrangeableModel.access$200(ArrangeableModel.java:52)
      at org.richfaces.model.ArrangeableModel$2.compare(ArrangeableModel.java:262)
      at java.util.Arrays.mergeSort(Arrays.java:1283)
      at java.util.Arrays.mergeSort(Arrays.java:1294)
      at java.util.Arrays.mergeSort(Arrays.java:1294)
      at java.util.Arrays.mergeSort(Arrays.java:1295)
      at java.util.Arrays.mergeSort(Arrays.java:1294)
      at java.util.Arrays.mergeSort(Arrays.java:1294)
      at java.util.Arrays.sort(Arrays.java:1223)
      at java.util.Collections.sort(Collections.java:176)
      at org.richfaces.model.ArrangeableModel.sort(ArrangeableModel.java:260)
      at org.richfaces.model.ArrangeableModel.arrange(ArrangeableModel.java:214)
      at org.richfaces.component.UIDataTableBase.createExtendedDataModel(UIDataTableBase.java:170)
      at org.richfaces.component.UIDataAdaptor.getExtendedDataModel(UIDataAdaptor.java:560)
      at org.richfaces.component.UIDataAdaptor.getRowCount(UIDataAdaptor.java:607)
      at org.richfaces.renderkit.AbstractTableRenderer.encodeTableRows(AbstractTableRenderer.java:147)
      at org.richfaces.renderkit.AbstractTableRenderer.doEncodeChildren(AbstractTableRenderer.java:209)
      at org.richfaces.renderkit.RendererBase.encodeChildren(RendererBase.java:157)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:849)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1643)
      at org.richfaces.renderkit.DataTableRenderer.encodeRow(DataTableRenderer.java:183)
      at org.richfaces.renderkit.AbstractRowsRenderer.process(AbstractRowsRenderer.java:62)
      at org.ajax4jsf.model.SequenceDataModel.walk(SequenceDataModel.java:109)
      at org.richfaces.component.UIDataAdaptor.walk(UIDataAdaptor.java:918)
      at org.richfaces.renderkit.AbstractRowsRenderer.encodeRows(AbstractRowsRenderer.java:72)
      at org.richfaces.renderkit.AbstractTableRenderer.encodeRows(AbstractTableRenderer.java:102)
      at org.richfaces.renderkit.AbstractRowsRenderer.processRows(AbstractRowsRenderer.java:80)
      at org.richfaces.renderkit.AbstractTableRenderer.encodeTableRows(AbstractTableRenderer.java:159)
      at org.richfaces.renderkit.AbstractTableRenderer.doEncodeChildren(AbstractTableRenderer.java:209)
      at org.richfaces.renderkit.RendererBase.encodeChildren(RendererBase.java:157)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:849)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1643)
      at org.richfaces.context.ExtendedPartialViewContextImpl$RenderVisitCallback.visit(ExtendedPartialViewContextImpl.java:517)
      at org.richfaces.context.BaseExtendedVisitContext.invokeVisitCallback(BaseExtendedVisitContext.java:480)
      at org.richfaces.component.UIDataAdaptor.visitTree(UIDataAdaptor.java:1343)
      at javax.faces.component.UIComponent.visitTree(UIComponent.java:1487)
      at javax.faces.component.UIForm.visitTree(UIForm.java:331)
      at javax.faces.component.UIComponent.visitTree(UIComponent.java:1487)
      at javax.faces.component.UIComponent.visitTree(UIComponent.java:1487)
      at javax.faces.component.UIComponent.visitTree(UIComponent.java:1487)
      at org.richfaces.context.ExtendedPartialViewContextImpl.processPartialRenderPhase(ExtendedPartialViewContextImpl.java:284)
      at org.richfaces.context.ExtendedPartialViewContextImpl.processPartial(ExtendedPartialViewContextImpl.java:206)
      at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:968)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1643)
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:378)
      at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127)
      at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:269)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:309)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.richfaces.tests.metamer.TestIdentityFilter.doFilter(TestIdentityFilter.java:93)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      at java.lang.Thread.run(Thread.java:636)
      Jan 12, 2011 2:28:15 PM org.richfaces.context.ExtendedPartialViewContextImpl$RenderVisitCallback logException
      SEVERE: null

        Gliffy Diagrams

          Issue Links

            Activity

            There are no comments yet on this issue.

              People

              • Assignee:
                Konstantin.Mishin Konstantin Mishin
                Reporter:
                lfryc Lukáš Fryč
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Development