ArrayIndexOutOfBoundsException in ContentField.activate(...)
| Newsgroups | gmane.comp.cms.jahia.devel |
|---|---|
| Message-ID | <OF07DF0036.F7B72DAA-ONC1256FFE.003705DC-C1256FFE.0037C97D@commaro.com> |
We are still using Jahia 4.0.5, but on heavy testing we encounter that the
workflow process is quite unstable sometimes. When looking in the LOG
files, I for instance can see an ArrayIndexOutOfBoundsException in the
ContentField.acivate(...) method.
In this loop we get this exception in the line
activeAndStagingEntryStates.remove (i);, because i has the value -1. It
seem strange anyway that the removing from the activeAndStagingEntryStates
collection is happening in the inner loop and not in the outer loop. As
you haven't changed the code in the 4.1 version it seems to work for
everybody else, or could it be that there is a bug?
// we backup all active entries that will be replaced
for (int i = 0; i < activeAndStagingEntryStates.size (); i++) {
ContentObjectEntryState actEntryState =
(ContentObjectEntryState) activeAndStagingEntryStates.get (
i);
if (actEntryState.isActive ()) {
for (int j = 0; j < stagedEntries.size (); j++) {
ContentObjectEntryState staEntryState =
(ContentObjectEntryState) stagedEntries.get (
j);
if (actEntryState.getLanguageCode ().equals (
staEntryState.getLanguageCode ())) {
// ok appollo, we catched an active entry here! we
handle this..
if (versioningEnabled) {
ContentObjectEntryState backupEntryState =
ContentFieldDB.getInstance ().backupDBValue (
this, actEntryState); // we backup the
active version
// ok we backuped an entry of the field
if (backupEntryState != null) {
// if the entry state list is loaded,
let's update it
if (versioningEntryStates != null) {
versioningEntryStates.add
(backupEntryState);
}
// also we must call the changeEntryState
because, like, we changed the version or
// something hehe..
this.changeEntryState (actEntryState,
backupEntryState,
jParams, stateModifContext);
}
} else {
// if versioning is not enabled, we delete the
old value content!
this.deleteEntry (actEntryState);
}
// we then delete the active entry
ContentFieldDB.getInstance ().deleteDBValue (this,
actEntryState);
activeAndStagingEntryStates.remove (i);
i -= 1;
}
}
}
}
Greetings,
Benjamin Papez