[299808] Protect against mutithreaded access to adapters during notify
diff --git a/features/org.eclipse.wst.common_core.feature.patch/buildnotes_org.eclipse.wst.common_core.feature.patch.html b/features/org.eclipse.wst.common_core.feature.patch/buildnotes_org.eclipse.wst.common_core.feature.patch.html
index 420dca1..6a40b80 100644
--- a/features/org.eclipse.wst.common_core.feature.patch/buildnotes_org.eclipse.wst.common_core.feature.patch.html
+++ b/features/org.eclipse.wst.common_core.feature.patch/buildnotes_org.eclipse.wst.common_core.feature.patch.html
@@ -32,6 +32,7 @@
<p>Bug <a href='https://bugs.eclipse.org/300267'>300267</a>. Deleting obsolete code - VirtualComponent.cleanUpReferences</p>
<p>Bug <a href='https://bugs.eclipse.org/301477'>301477</a>. EAR Libraries container missing entries on restart</p>
<p>Bug <a href='https://bugs.eclipse.org/301549'>301549</a>. ComponentResolver performance improvement</p>
+<p>Bug <a href='https://bugs.eclipse.org/299808'>299808</a>. Protect against mutithreaded access to adapters during notify</p>
</body>
</html>
\ No newline at end of file
diff --git a/features/org.eclipse.wst.common_core.feature.patch/feature.properties b/features/org.eclipse.wst.common_core.feature.patch/feature.properties
index d2cb6c8..2076158 100644
--- a/features/org.eclipse.wst.common_core.feature.patch/feature.properties
+++ b/features/org.eclipse.wst.common_core.feature.patch/feature.properties
@@ -46,6 +46,7 @@
Bug https://bugs.eclipse.org/300267 Deleting obsolete code - VirtualComponent.cleanUpReferences\n\
Bug https://bugs.eclipse.org/301477 EAR Libraries container missing entries on restart\n\
Bug https://bugs.eclipse.org/301549 ComponentResolver performance improvement\n\
+Bug https://bugs.eclipse.org/299808 Protect against mutithreaded access to adapters during notify\n\
\n\
# "copyright" property - text of the "Feature Update Copyright"
copyright=\
diff --git a/plugins/org.eclipse.jem.util/META-INF/MANIFEST.MF b/plugins/org.eclipse.jem.util/META-INF/MANIFEST.MF
index 7026cf2..d676f89 100644
--- a/plugins/org.eclipse.jem.util/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jem.util/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jem.util; singleton:=true
-Bundle-Version: 2.0.103.qualifier
+Bundle-Version: 2.0.104.qualifier
Bundle-Activator: org.eclipse.jem.util.plugin.JEMUtilPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/internal/util/emf/workbench/ProjectResourceSetImpl.java b/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/internal/util/emf/workbench/ProjectResourceSetImpl.java
index 5832ce4..206e393 100644
--- a/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/internal/util/emf/workbench/ProjectResourceSetImpl.java
+++ b/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/internal/util/emf/workbench/ProjectResourceSetImpl.java
@@ -10,7 +10,7 @@
*******************************************************************************/
/*
* $$RCSfile: ProjectResourceSetImpl.java,v $$
- * $$Revision: 1.21.2.1.2.3 $$ $$Date: 2009/11/05 07:31:10 $$
+ * $$Revision: 1.21.2.1.2.4 $$ $$Date: 2010/02/18 04:36:00 $$
*/
package org.eclipse.jem.internal.util.emf.workbench;
@@ -22,10 +22,10 @@
import org.eclipse.core.runtime.content.IContentDescription;
import org.eclipse.core.runtime.jobs.ILock;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.NotificationImpl;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.common.util.*;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.*;
import org.eclipse.emf.ecore.resource.Resource.Factory;
@@ -887,5 +887,31 @@
}
return resources;
}
+ @Override
+ public void eNotify(Notification notification) {
+ Adapter[] eAdapters = eBasicAdapterArray();
+ if (eAdapters != null && eDeliver())
+ {
+ for (int i = 0, size = eAdapters.length; i < size; ++i)
+ {
+ Adapter temp;
+ if ((temp = eAdapters[i]) != null)
+ temp.notifyChanged(notification);
+ }
+ }
+ }
+ /**
+ * Returns the underlying array of adapters.
+ * The length of this array reflects exactly the number of adapters
+ * where <code>null</code> represents the lack of any adapters.
+ * This array may not be modified by the caller
+ * and must be guaranteed not to be modified even if the {@link #eAdapters() list of adapters} is modified.
+ * @return the underlying array of adapters.
+ */
+ protected Adapter[] eBasicAdapterArray()
+ {
+ BasicEList<Adapter> eBasicAdapters = eBasicAdapters();
+ return eBasicAdapters == null ? null : (Adapter[])eBasicAdapters.data();
+ }
}
diff --git a/plugins/org.eclipse.wst.common.emf/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.common.emf/META-INF/MANIFEST.MF
index 4175e36..922c51c 100644
--- a/plugins/org.eclipse.wst.common.emf/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.common.emf/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.common.emf; singleton:=true
-Bundle-Version: 1.1.205.qualifier
+Bundle-Version: 1.1.206.qualifier
Bundle-Activator: org.eclipse.wst.common.internal.emf.plugin.EcoreUtilitiesPlugin
Bundle-Vendor: %pluginProvider
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/resource/TranslatorResourceImpl.java b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/resource/TranslatorResourceImpl.java
index 5d09434..ff7d624 100644
--- a/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/resource/TranslatorResourceImpl.java
+++ b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/resource/TranslatorResourceImpl.java
@@ -16,8 +16,10 @@
import java.util.Collection;
import java.util.Map;
+import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.NotificationImpl;
+import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
@@ -393,4 +395,30 @@
loadExisting(options);
}
}
+
+ public void eNotify(Notification notification) {
+ Adapter[] eAdapters = eBasicAdapterArray();
+ if (eAdapters != null && eDeliver())
+ {
+ for (int i = 0, size = eAdapters.length; i < size; ++i)
+ {
+ Adapter temp;
+ if ((temp = eAdapters[i]) != null)
+ temp.notifyChanged(notification);
+ }
+ }
+ }
+ /**
+ * Returns the underlying array of adapters.
+ * The length of this array reflects exactly the number of adapters
+ * where <code>null</code> represents the lack of any adapters.
+ * This array may not be modified by the caller
+ * and must be guaranteed not to be modified even if the {@link #eAdapters() list of adapters} is modified.
+ * @return the underlying array of adapters.
+ */
+ protected Adapter[] eBasicAdapterArray()
+ {
+ BasicEList eBasicAdapters = eBasicAdapters();
+ return eBasicAdapters == null ? null : (Adapter[])eBasicAdapters.data();
+ }
}