-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 #3245
Comments
@javaserverfaces Commented |
@javaserverfaces Commented { ((StateHolder) l).restoreState(context, attachedObjects[i]); } } // this.attachedObjects seems to be empty whereas state contains some objects in my case.... |
@javaserverfaces Commented java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 |
@javaserverfaces Commented |
@javaserverfaces Commented An additional size-check of this.attachedObjects solves my problem (see attached patch file). |
@javaserverfaces Commented
|
@javaserverfaces Commented |
@javaserverfaces Commented A check of the boundaries of this.attachedObjects would really help in this situation. |
@javaserverfaces Commented |
@javaserverfaces Commented The exception does not occur when javax.faces.PARTIAL_STATE_SAVING is set to false. Do you have any regression tests checking the thread-safety of partial state saving? My environment: WildFly 8.0.0.Final (including Mojarra 2.2.5), Oracle Java 1.8.0_05. |
@javaserverfaces Commented |
@javaserverfaces Commented |
@javaserverfaces Commented |
@javaserverfaces Commented |
@javaserverfaces Commented |
@javaserverfaces Commented A proper solution would account for the fact that RequiredValidator does not implement StateHolder (see JAVASERVERFACES_SPEC_PUBLIC-1279) and take the necessary action, namely to serialize the instance. |
@javaserverfaces Commented |
@javaserverfaces Commented |
@javaserverfaces Commented Actually, the fact that RequiredValidator is not a StateHolder, is not the main reason which cause this issue. Currently the class AttachedObjectListHolder's initialState is not designed clearly, e.g., one variable for multiple validators. I found a simple way to fix the issue and the solution is based on the assumption that the dynamically added validators should be kept between requests in the same session, I attache the changebundle here for your review. Thanks, |
@javaserverfaces Commented |
@javaserverfaces Commented |
@javaserverfaces Commented |
@javaserverfaces Commented r=edburns. |
@javaserverfaces Commented |
@javaserverfaces Commented
|
@javaserverfaces Commented
Can we reopen this or should I create a new ticket? |
@javaserverfaces Commented Can you attach your application here to reproduce the issue? In my commitment in -r13723, there was an test case which verify the issue has been fixed. so I need you to provide a reproducer to do the investigation. BR, |
@javaserverfaces Commented This is what I think was happening:
After removing my dirty hack (and replacing it with the correct fix inspired from this post, which was clearing the JSF headers and parameters that marking the request as a partial update ajax call, I now get a proper ViewExpiredException. |
@javaserverfaces Commented I just debugged through the relevant statements
There seems to be a "code smell": attachedObjects and this.attachedObjects are two different objects. Could someone have a look on it? |
@javaserverfaces Commented
|
|
IndexOutOfBoundsException caused by javax.faces.component.AttachedObjectListHolder::restoreState(FacesContext context, Object state)
Affected Versions
[2.2.6]
The text was updated successfully, but these errors were encountered: