Skip to content
Snippets Groups Projects
Commit 1d878c9d authored by srosse's avatar srosse
Browse files

OO-582: synchronize the iterator of history list

parent 6d797c7b
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
package org.olat.core.util; package org.olat.core.util;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
...@@ -264,7 +265,7 @@ public class UserSession implements HttpSessionBindingListener, GenericEventList ...@@ -264,7 +265,7 @@ public class UserSession implements HttpSessionBindingListener, GenericEventList
} }
public List<HistoryPoint> getHistoryStack() { public List<HistoryPoint> getHistoryStack() {
return history; return new ArrayList<HistoryPoint>(history);
} }
public HistoryPoint getLastHistoryPoint() { public HistoryPoint getLastHistoryPoint() {
...@@ -294,10 +295,12 @@ public class UserSession implements HttpSessionBindingListener, GenericEventList ...@@ -294,10 +295,12 @@ public class UserSession implements HttpSessionBindingListener, GenericEventList
String uuid = ureq.getUuid(); String uuid = ureq.getUuid();
if(!history.isEmpty()) { if(!history.isEmpty()) {
//consolidate //consolidate
for(Iterator<HistoryPoint> it=history.iterator(); it.hasNext(); ) { synchronized(history) {
HistoryPoint p = it.next(); for(Iterator<HistoryPoint> it=history.iterator(); it.hasNext(); ) {
if(uuid.equals(p.getUuid())) { HistoryPoint p = it.next();
it.remove(); if(uuid.equals(p.getUuid())) {
it.remove();
}
} }
} }
} }
...@@ -311,10 +314,12 @@ public class UserSession implements HttpSessionBindingListener, GenericEventList ...@@ -311,10 +314,12 @@ public class UserSession implements HttpSessionBindingListener, GenericEventList
public void removeFromHistory(BusinessControl businessControl) { public void removeFromHistory(BusinessControl businessControl) {
String businessPath = businessControl.getAsString(); String businessPath = businessControl.getAsString();
for(Iterator<HistoryPoint> it=history.iterator(); it.hasNext(); ) { synchronized(history) {
String path = it.next().getBusinessPath(); for(Iterator<HistoryPoint> it=history.iterator(); it.hasNext(); ) {
if(path.startsWith(businessPath)) { String path = it.next().getBusinessPath();
it.remove(); if(path.startsWith(businessPath)) {
it.remove();
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment