Details
-
Type: Improvement
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 4.2
-
Fix Version/s: 4.3, EE-3.3.0.GA_P06
-
Component/s: MOBI-Components
-
Labels:None
-
Environment:mobi dataView activeRowIndex
-
Support Case References:Support Case 14070:- https://icesoft.my.salesforce.com/5007000001izlvB?srPos=0&srKp=500
Description
Thought originally, this would just need some null checking so went about and created a test case (added to QA test in dataView page dataViewNullVal.xhtml).
However, in the DataView Class, if an value for dataView is null, the DataView class sets it to an empty collection, to do the rest of the work, so.....not so straight forward. the activeRowIndex then works forward on this assumption..but dataView value is still null, so a bit more of a rework than originally thought.
{code}
18-Apr-2017 14:31:34.494 WARNING [http-nio-8080-exec-4] org.icefaces.mobi.component.dataview.DataView.getDataModel DataView: form:dataView - 'value' attribute is null.
18-Apr-2017 14:31:34.495 SEVERE [http-nio-8080-exec-4] com.sun.faces.application.view.FaceletViewHandlingStrategy.handleRenderException Error Rendering View[/dataViewEmptyValue.xhtml]
java.lang.IndexOutOfBoundsException: Index: 2
at java.util.Collections$EmptyList.get(Collections.java:4454)
at org.icefaces.mobi.model.dataview.DataViewListDataModel.getDataByIndex(DataViewListDataModel.java:40)
at org.icefaces.mobi.component.dataview.DataView.initDetailContext(DataView.java:180)
at org.icefaces.mobi.component.dataview.DataView.visitTree(DataView.java:92)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
at javax.faces.component.UIForm.visitTree(UIForm.java:371)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
at org.icefaces.impl.event.RestoreResourceDependencies.processEvent(RestoreResourceDependencies.java:48)
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:108)
at javax.faces.event.ComponentSystemEvent.processListener(ComponentSystemEvent.java:118)
at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2169)
at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2142)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:301)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:245)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:857)
at javax.faces.component.UIViewRoot.encodeBegin(UIViewRoot.java:985)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1854)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:432)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
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:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
{code}
However, in the DataView Class, if an value for dataView is null, the DataView class sets it to an empty collection, to do the rest of the work, so.....not so straight forward. the activeRowIndex then works forward on this assumption..but dataView value is still null, so a bit more of a rework than originally thought.
{code}
18-Apr-2017 14:31:34.494 WARNING [http-nio-8080-exec-4] org.icefaces.mobi.component.dataview.DataView.getDataModel DataView: form:dataView - 'value' attribute is null.
18-Apr-2017 14:31:34.495 SEVERE [http-nio-8080-exec-4] com.sun.faces.application.view.FaceletViewHandlingStrategy.handleRenderException Error Rendering View[/dataViewEmptyValue.xhtml]
java.lang.IndexOutOfBoundsException: Index: 2
at java.util.Collections$EmptyList.get(Collections.java:4454)
at org.icefaces.mobi.model.dataview.DataViewListDataModel.getDataByIndex(DataViewListDataModel.java:40)
at org.icefaces.mobi.component.dataview.DataView.initDetailContext(DataView.java:180)
at org.icefaces.mobi.component.dataview.DataView.visitTree(DataView.java:92)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
at javax.faces.component.UIForm.visitTree(UIForm.java:371)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
at org.icefaces.impl.event.RestoreResourceDependencies.processEvent(RestoreResourceDependencies.java:48)
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:108)
at javax.faces.event.ComponentSystemEvent.processListener(ComponentSystemEvent.java:118)
at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2169)
at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2142)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:301)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:245)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:857)
at javax.faces.component.UIViewRoot.encodeBegin(UIViewRoot.java:985)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1854)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:432)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
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:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
{code}
r52181: added checks to see if the size of the data model is big enough to contain an item at the specified row index before attempting to retrieve the item at such index, in order to avoid IndexOutOfBoundsException exceptions