Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 2.1-Beta
-
Component/s: ACE-Components
-
Labels:None
-
Environment:ACE, Mojarra 2.1.3
-
Assignee Priority:P1
Description
An exception occurs when using ace:dataTable and a header columnGroup, and trying to sort.
From the server log we can see that ColumnBase is trying to state save a Map, which has a null value in it, that's causing the exception. Since column has no Map properties, and the stack trace isn't showing much saveState recursion, it's likely that it's the StateHelper's own Map that has the null entry.
java.lang.NullPointerException
at javax.faces.component.StateHolderSaver.<init>(StateHolderSaver.java:96)
at javax.faces.component.UIComponentBase.saveAttachedState(UIComponentBase.java:1695)
at javax.faces.component.ComponentStateHelper.saveMap(ComponentStateHelper.java:378)
at javax.faces.component.ComponentStateHelper.saveState(ComponentStateHelper.java:256)
at javax.faces.component.UIComponentBase.saveState(UIComponentBase.java:1501)
at org.icefaces.ace.component.column.ColumnBase.saveState(ColumnBase.java:1324)
at com.sun.faces.application.view.StateManagementStrategyImpl$1.visit(StateManagementStrategyImpl.java:168)
at com.sun.faces.component.visit.FullVisitContext.invokeVisitCallback(FullVisitContext.java:151)
at org.icefaces.ace.component.datatable.DataTable.visitColumnsAndColumnFacets(DataTable.java:502)
at org.icefaces.ace.component.datatable.DataTable.visitTree(DataTable.java:466)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600)
at javax.faces.component.UIForm.visitTree(UIForm.java:344)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600)
at com.sun.faces.application.view.StateManagementStrategyImpl.saveView(StateManagementStrategyImpl.java:160)
at com.sun.faces.application.StateManagerImpl.saveView(StateManagerImpl.java:133)
at javax.faces.application.StateManager.getViewState(StateManager.java:553)
at org.icefaces.impl.context.DOMPartialViewContext.renderState(DOMPartialViewContext.java:448)
at org.icefaces.impl.context.DOMPartialViewContext.processPartial(DOMPartialViewContext.java:205)
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)
From the server log we can see that ColumnBase is trying to state save a Map, which has a null value in it, that's causing the exception. Since column has no Map properties, and the stack trace isn't showing much saveState recursion, it's likely that it's the StateHelper's own Map that has the null entry.
java.lang.NullPointerException
at javax.faces.component.StateHolderSaver.<init>(StateHolderSaver.java:96)
at javax.faces.component.UIComponentBase.saveAttachedState(UIComponentBase.java:1695)
at javax.faces.component.ComponentStateHelper.saveMap(ComponentStateHelper.java:378)
at javax.faces.component.ComponentStateHelper.saveState(ComponentStateHelper.java:256)
at javax.faces.component.UIComponentBase.saveState(UIComponentBase.java:1501)
at org.icefaces.ace.component.column.ColumnBase.saveState(ColumnBase.java:1324)
at com.sun.faces.application.view.StateManagementStrategyImpl$1.visit(StateManagementStrategyImpl.java:168)
at com.sun.faces.component.visit.FullVisitContext.invokeVisitCallback(FullVisitContext.java:151)
at org.icefaces.ace.component.datatable.DataTable.visitColumnsAndColumnFacets(DataTable.java:502)
at org.icefaces.ace.component.datatable.DataTable.visitTree(DataTable.java:466)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600)
at javax.faces.component.UIForm.visitTree(UIForm.java:344)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600)
at com.sun.faces.application.view.StateManagementStrategyImpl.saveView(StateManagementStrategyImpl.java:160)
at com.sun.faces.application.StateManagerImpl.saveView(StateManagerImpl.java:133)
at javax.faces.application.StateManager.getViewState(StateManager.java:553)
at org.icefaces.impl.context.DOMPartialViewContext.renderState(DOMPartialViewContext.java:448)
at org.icefaces.impl.context.DOMPartialViewContext.processPartial(DOMPartialViewContext.java:205)
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)
Issue Links
- blocks
-
ICE-7329 ace:dataTable - sorting not working for table using column grouping
- Closed
The generated setter methods only use Map.put() to set the values, and the Mojarra code chokes on hitting Map entries with null values, as it tries to get at the class name from the object. So instead, let's remove the entry from the Map if the value is null, and let the getter method fall through to returning the default value. This is basically how standard JSF getter/setter methods work. It's unfortunate that the precludes setting a null value for a property that has a non-null default value.