3305 consumers of Navigator's getPath subject to ConcurrentModificationExceptions
--- a/usr/src/java/vpanels/client/org/opensolaris/os/vp/client/swing/AddressPanel.java Mon Sep 08 16:04:32 2008 -0400
+++ b/usr/src/java/vpanels/client/org/opensolaris/os/vp/client/swing/AddressPanel.java Mon Sep 08 16:32:41 2008 -0400
@@ -69,10 +69,12 @@
@Override
public void navigationStopped(final NavigationEvent e) {
- EventQueue.invokeLater(
+ GUIUtil.invokeAndWait(
new Runnable() {
@Override
public void run() {
+ // getPath is safe here because invokeAndWait is
+ // (presumably) being run by the navigation thread
setAddress(e.getSource().getPath());
}
});
--- a/usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/common/control/Navigator.java Mon Sep 08 16:04:32 2008 -0400
+++ b/usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/common/control/Navigator.java Mon Sep 08 16:32:41 2008 -0400
@@ -60,7 +60,6 @@
//
private StackList<Control> stack = new StackList<Control>();
- private List<Control> roStack = Collections.unmodifiableList(stack);
private List<NavigationListener> listeners =
new ArrayList<NavigationListener>();
@@ -187,21 +186,22 @@
}
/**
- * Gets the current path.
+ * Gets the current path. This method is not thread-safe; it is up to
+ * callers to ensure the that navigation is not currently modifying this
+ * path.
*/
+ @SuppressWarnings({"unchecked"})
public List<Control> getPath() {
- synchronized (stack) {
- return roStack;
- }
+ return (List<Control>)stack.clone();
}
/**
- * Gets the current path as a {@code String}.
+ * Gets the current path as a {@code String}. This method is not
+ * thread-safe; it is up to callers to ensure the that navigation is not
+ * currently modifying this path.
*/
public String getPathString() {
- synchronized (stack) {
- return getPathString(stack);
- }
+ return getPathString(stack);
}
/**