ICEfaces
  1. ICEfaces
  2. ICE-7348

ACE generator stores null values that JSF state saving can not handle

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1-Beta
    • Fix Version/s: 2.1-Beta2, 3.0
    • 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)

        Issue Links

          Activity

          Mark Collette created issue -
          Mark Collette made changes -
          Field Original Value New Value
          Assignee Mark Collette [ mark.collette ]
          Hide
          Mark Collette added a comment -

          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.

          Show
          Mark Collette added a comment - 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.
          Hide
          Mark Collette added a comment -

          Had to differentiate between primitive values, that cannot be null, and non-primitives, that can be null. The code for setting the defVal is a little funky, but after careful consideration I don't think it should cause any problems.

          Internal development repository
          Subversion 25914
          ace/generator/src/org/icefaces/ace/generator/artifacts/ComponentArtifact.java

          Show
          Mark Collette added a comment - Had to differentiate between primitive values, that cannot be null, and non-primitives, that can be null. The code for setting the defVal is a little funky, but after careful consideration I don't think it should cause any problems. Internal development repository Subversion 25914 ace/generator/src/org/icefaces/ace/generator/artifacts/ComponentArtifact.java
          Mark Collette made changes -
          Link This issue blocks ICE-7329 [ ICE-7329 ]
          Mark Collette made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Assignee Priority P1
          Resolution Fixed [ 1 ]
          Ken Fyten made changes -
          Fix Version/s 2.1-Beta2 [ 10294 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #26436 Fri Nov 18 10:04:23 MST 2011 ken.fyten ICE-6112 added code for generating faces-config.xml entries for behaviors; adjusted ajax and animation tag handlers to these changes
          ICE-6884 : When ACE component in iterative container, setting ace property during render affects all rows
          ICE-6849 : @Field of type List not generating
          ICE-6394 modifications to remove reference to AnimationBehaviour in hardcoded FacesConfigBuilder. It is now part of the faces-confix.xml to be merged
          ICE-6934 modified generator to accept parameters for short name and namespace in the build script
          ICE-7299 : Generator generates wrong attribute name with the for attribute
          ICE-7348 : ACE generator stores null values that JSF state saving can not handle
          ICE-7321 Added checking in setters to see if the component is disconnected from the component tree to store attributes as default values, rather than row values
          ICE-7031 added Meta class for ajax tag handler; added 'behaviorId' attribute to @TagHandler annotation for BehaviorHandler's; adjusted animation tag handler to this change
          ICE-6118 : Enhance build scripts to allow for compiling and building libraries and samples against MyFaces
          ICE-6970 Adopted Apache 2.0 license source-code headers for ACE source-code.
          Files Changed
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/baseMeta/UIComponentMeta.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/utils/PropertyValues.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/annotation/Facet.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/annotation/DefaultValueType.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/utils/Utility.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/artifacts/TagArtifact.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/build.xml
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/artifacts/Artifact.java
          Commit graph ADD /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/baseMeta/HtmlInputTextMeta.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/Generator.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/annotation/ClientBehaviorHolder.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/behavior/ClientBehaviorHolder.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/annotation/Properties.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/artifacts/ComponentArtifact.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/annotation/Component.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/xmlbuilder/FacesConfigBuilder.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/baseMeta/UISelectBooleanMeta.java
          Commit graph ADD /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/artifacts/TagHandlerArtifact.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/annotation/ActionSource.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/baseMeta/UICommandMeta.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/annotation/Implementation.java
          Commit graph ADD /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/context/TagHandlerContext.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/build.properties
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/annotation/Expression.java
          Commit graph ADD /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/annotation/TagHandler.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/annotation/Facets.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/baseMeta/UIOutputMeta.java
          Commit graph ADD /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/annotation/TagHandlerType.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/baseMeta/UIDataMeta.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/baseMeta/UIInputMeta.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/annotation/Property.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/xmlbuilder/TLDBuilder.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/baseMeta/UIMessageMeta.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/utils/FileWriter.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/behavior/Behavior.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/context/GeneratorContext.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/baseMeta/UIComponentBaseMeta.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/baseMeta/UISelectManyMeta.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/xmlbuilder/FaceletTagLibBuilder.java
          Commit graph ADD /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/annotation/ClientEvent.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/baseMeta/UIMessagesMeta.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/annotation/Field.java
          Commit graph ADD /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/context/MetaContext.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/baseMeta/UISelectOneMeta.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/context/ComponentContext.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/annotation/Required.java
          Commit graph ADD /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/xmlbuilder/FacesConfigMerge.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/TaglibMerge.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/baseMeta/UIPanelMeta.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/xmlbuilder/XMLBuilder.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/artifacts/ComponentHandlerArtifact.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/baseMeta/UIColumnMeta.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/meta/baseMeta/UIFormMeta.java
          Commit graph MODIFY /icefaces3/trunk/icefaces/ace/generator/src/org/icefaces/ace/generator/behavior/ActionSourceBehavior.java
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Mark Collette
              Reporter:
              Mark Collette
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: