Bug 411718 - ConcurrentModificationException in org.eclipse.osgi.internal.resolver.StateWriter.writeList
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateWriter.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateWriter.java
index 57a10d0..88e85ba 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateWriter.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateWriter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2012 IBM Corporation and others.
+ * Copyright (c) 2003, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -679,10 +679,12 @@
}
public void saveStateDeprecated(StateImpl state, DataOutputStream output) throws IOException {
- try {
- writeStateDeprecated(state, output);
- } finally {
- output.close();
+ synchronized (state.monitor) {
+ try {
+ writeStateDeprecated(state, output);
+ } finally {
+ output.close();
+ }
}
}