Issue Details (XML | Word | Printable)

Key: JAVASERVERFACES-2390
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Manfred Riem
Reporter: prakashudupa
Votes: 1
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
javaserverfaces

Children component reorder leads to exception and reorder failure

Created: 19/Apr/12 04:11 PM   Updated: 03/Jul/12 01:23 PM   Resolved: 03/Jul/12 01:23 PM
Component/s: state saving
Affects Version/s: 2.1.8
Fix Version/s: 2.1.9

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive Application73.zip (4.71 MB) 19/Apr/12 04:11 PM - prakashudupa


Tags: ADF dynamic
Participants: Manfred Riem and prakashudupa


 Description  « Hide

In Trinidad framework, we have a customization / changeManager feature, one of the subfeatures there is to be able to reorder child components of the same parent. The usecase is a very common Design-time at Run-time feature where the components are reordered inside same container parent by Drag-And-Drop in a canvas. This feature is broken when we are trying to update to Mojarra 2.1.8, so this is a regression from Mojarra 2.1.7 for which we are requesting a fix a.s.a.p.

I have tried to scale down this feature in a simple managed bean code and attached the testcase. All I'm doing in the managed bean is re-ordering children, and expecting that 1. if the component tree state is restored by RI, the new order is restored, or 2. if the jsf page is re-read and tags re-executed, then RI should re-instate the children is in its original index.

To test it, run the 'Trinidad_testpage.jsf' page provided as testcase (note the components are from Trinidad, so you will need to include Trinidad library, you can yourself emulate the behavior in any other component library you wish, since the essense of defect is showcased). In the page, click on the button, this is expected to reorder the two outputText children (you will see this happen fine in 2.1.7). In 2.1.8, instead, the following exception is encountered and the reorder fails.

It seems that RI is calling on the List implementation to add a child at a index greater than zero, at a point when there were no children at all.

Note that
1. The issue happens only for facelets case, not JSP.
2. The issue happens when partial state saving is enabled or disabled.

About the attached testcase:
1. application73.zip is a JDeveloper workspace, if you have JDev installed, it is convenient for you to just run it.
2. If you do not have JDev, then you can extract out / study the code in 'ChangeBeanOne.java' , 'DebugPhaseListener.java', 'Trinidad_testpage.jsf' and it should be easy for you to do the same using any component library / IDE.
3. It is assumed that you would run it first in 2.1.7 to see all is well, and then you can instead use the 2.1.8 jar provided in the zip file to see the issue (in JDev it is easy, you remove the included JSF 2.1 library, and add the included jars as the top entry in class path for the test app)



prakashudupa added a comment - 19/Apr/12 04:12 PM

java.lang.IndexOutOfBoundsException: index:1 size:0
at org.apache.myfaces.trinidad.component.ChildArrayList.add(ChildArrayList.java:47)
at org.apache.myfaces.trinidad.component.ChildArrayList.add(ChildArrayList.java:33)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.adjustIndexOfDynamicChildren(ComponentTagHandlerDelegateImpl.java:239)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:201)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at oracle.adfinternal.view.faces.facelets.rich.RichDocumentHandler.applyNextHandler(RichDocumentHandler.java:69)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at com.sun.faces.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:164)
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:152)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:774)
at org.apache.myfaces.trinidadinternal.application.ViewDeclarationLanguageFactoryImpl$ChangeApplyingVDLWrapper.buildView(ViewDeclarationLanguageFactoryImpl.java:345)
at oracle.adfinternal.view.faces.lifecycle.ResponseRenderManager._processViewDefinitionLanguage(ResponseRenderManager.java:105)
at oracle.adfinternal.view.faces.lifecycle.ResponseRenderManager.runRenderView(ResponseRenderManager.java:41)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:1111)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:395)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:243)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:279)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:253)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:135)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:340)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
at oracle.adf.share.http.ServletADFFilter.doFilter(ServletADFFilter.java:65)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:478)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:478)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:303)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:208)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:136)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:440)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:119)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:216)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:81)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:173)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3290)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3256)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2164)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2090)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2068)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1528)
at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:263)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:222)


Manfred Riem added a comment - 19/Apr/12 06:19 PM

Can you try it tomorrow (4/20/2012) with the latest SNAPSHOT and tell me if you still see the issue?


prakashudupa added a comment - 19/Apr/12 06:47 PM

If you can email me the jsf-api*.jar and jsf-impl*.jar as soon as it is available, I can test it.
If it will be in some location that I can download from, give me the URL.


Manfred Riem added a comment - 19/Apr/12 09:04 PM

The following locations contain the API and Impl jars, please get the one that
is build tonight.

API https://maven.java.net/content/repositories/snapshots/com/sun/faces/jsf-api/
Impl https://maven.java.net/content/repositories/snapshots/com/sun/faces/jsf-impl/


prakashudupa added a comment - 20/Apr/12 06:02 PM

I tested this in today's staged jars, the issue continues to occur there.
For records, here is the manifest of the staged jsf-api-2.1.8.jar, which by time stamp I think indicates yesterday's SNAPSHOT, let me know if it is not.

Implementation-Title: Mojarra
Probe-Provider-Xml-File-Names: META-INF/mojarra-jsf-api-probe-provider
.xml
Tool: Bnd-0.0.249
DSTAMP: 20120419
TODAY: April 19 2012
TSTAMP: 1428
DocName: JavaServer Faces API
Implementation-Vendor: Oracle America, Inc.
Implementation-Vendor-Id: com.sun
Specification-Title: JavaServer Faces
Bundle-License: http://glassfish.java.net/nonav/public/CDDL+GPL.html
LICENSEFILE: /files/hudson/workspace/MOJARRA_2_1X_ROLLING_DEPLOY/MOJAR
RA_2_1X_ROLLING/legal/jsf-cddl/LICENSE.txt
Bundle-SymbolicName: org.glassfish.javax.faces
Extension-Name: javax.faces
Implementation-Version: 2.1.8-
Bundle-Name: JavaServer Faces API 2.1.8 (20120419-1428-)
DynamicImport-Package: org.glassfish.flashlight.provider
Bundle-Version: 2.1.8
Bnd-LastModified: 1334871019926
Bundle-ManifestVersion: 2
Bundle-Description: Mojarra JSF API (javax.faces/2.1) 2.1.8 (20120419-
1428-)
Specification-Version: 2.1
Include-Resource: META-INF=build/classes/META-INF,build/classes
Import-Package: javax.el;version="2.2.1",javax.servlet;version="3.0",j
avax.servlet.http;version="3.0",javax.servlet.jsp;version="2.1",javax
.servlet.jsp.jstl.sql;version="1.2",javax.servlet.jsp.tagext;version=
"2.1",javax.validation;resolution:=optional,javax.validation.groups;r
esolution:=optional
Bundle-DocURL: http://download.oracle.com/javaee/6/api/


prakashudupa added a comment - 20/Apr/12 11:14 PM

Note: This occurred in 2.1.4 and 2.1.8., but not in 2.1.7.


Manfred Riem added a comment - 30/May/12 04:11 PM

Can you verify if it works against the 2.1.8 release or the latest 2.1.9 SNAPSHOT?


Manfred Riem added a comment - 19/Jun/12 01:32 PM

Can you please verify against 2.1.9? Thanks!


prakashudupa added a comment - 03/Jul/12 03:36 AM

I tested this in 2.1.9, the issue appears solved there. Thanks Manfred !!

For records, here is the manifest of the jsf-api-2.1.9.jar, that I used:

Implementation-Title: Mojarra
Probe-Provider-Xml-File-Names: META-INF/mojarra-jsf-api-probe-provider
.xml
Tool: Bnd-0.0.249
DSTAMP: 20120531
TODAY: May 31 2012
TSTAMP: 2113
DocName: JavaServer Faces API
Implementation-Vendor: Oracle America, Inc.
Implementation-Vendor-Id: com.sun
Specification-Title: JavaServer Faces
Bundle-License: http://glassfish.java.net/nonav/public/CDDL+GPL.html
LICENSEFILE: /Users/rkitain/jsf/mojarra/tags/2.1.9/legal/jsf-cddl/LICE
NSE.txt
Bundle-SymbolicName: org.glassfish.javax.faces
Extension-Name: javax.faces
Implementation-Version: 2.1.9-
Bundle-Name: JavaServer Faces API 2.1.9 (20120531-2113-)
DynamicImport-Package: org.glassfish.flashlight.provider
Bundle-Version: 2.1.9
Bnd-LastModified: 1338513251922
Bundle-ManifestVersion: 2
Bundle-Description: Mojarra JSF API (javax.faces/2.1) 2.1.9 (20120531-
2113-)
Specification-Version: 2.1
Include-Resource: META-INF=build/classes/META-INF,build/classes
Import-Package: javax.el;version="2.2.1",javax.servlet;version="3.0",j
avax.servlet.http;version="3.0",javax.servlet.jsp;version="2.1",javax
.servlet.jsp.jstl.sql;version="1.2",javax.servlet.jsp.tagext;version=
"2.1",javax.validation;resolution:=optional,javax.validation.groups;r
esolution:=optional
Bundle-DocURL: http://download.oracle.com/javaee/6/api/