Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 2.0.2
-
Component/s: Framework, ICE-Components
-
Labels:None
-
Environment:ICEfaces 2 MyFaces 2
Description
In trying to get MyFaces running with ICEfaces 2 (ICE-5868) I found that a couple of components are not operating properly due to the timing of state saving. The two currently known components with issues are:
OutputChart: after the chart is initially rendered, clicking on the image map points generates an NPE
Caused by: java.lang.NullPointerException
at com.icesoft.faces.component.outputchart.OutputChart.getGeneratedImageMapArea(OutputChart.java:414)
at com.icesoft.faces.component.outputchart.OutputChart.decode(OutputChart.java:359)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1204)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1198)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1198)
at javax.faces.component.UIForm.processDecodes(UIForm.java:114)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1198)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1198)
at javax.faces.component.UIViewRoot._processDecodesDefault(UIViewRoot.java:1320)
...
Progress Bar: the progress bar is not updated even though Push is operating properly.
OutputChart: after the chart is initially rendered, clicking on the image map points generates an NPE
Caused by: java.lang.NullPointerException
at com.icesoft.faces.component.outputchart.OutputChart.getGeneratedImageMapArea(OutputChart.java:414)
at com.icesoft.faces.component.outputchart.OutputChart.decode(OutputChart.java:359)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1204)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1198)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1198)
at javax.faces.component.UIForm.processDecodes(UIForm.java:114)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1198)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1198)
at javax.faces.component.UIViewRoot._processDecodesDefault(UIViewRoot.java:1320)
...
Progress Bar: the progress bar is not updated even though Push is operating properly.
Both of the component issues are related to the strategy and timing of state saving in MyFaces.
With Mojarra, a marker/placeholder is used and state saving is not done until getViewState() is actually called. In Mojarra, this is done when the response is being written and the marker is being replaced.
With MyFaces, a marker is not used and getViewState() is called during the normal render process to inject the ViewState into the page. However, state saving is also done at this time but only once (as an optimization). Because of this, elements on the page that have not finished setting various state related values will not have those values saved and restored properly. For example, note the order of events as they are logged when the progress bar is updating:
OutputProgress.saveState: null
OutputProgressModel.setPercentComplete: 50
OutputProgress.restoreState: null
OutputProgressModel.getPercentComplete: 0
OutputProgressRenderer.setPercentage: 0
The issue is similar for the Chart component as the actual Chart resource is not state saved and is therefore not available to be restored when the user clicks on the image map.