Author: scabanovich
Date: 2012-10-18 19:11:56 -0400 (Thu, 18 Oct 2012)
New Revision: 44590
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java
Log:
JBIDE-12896
https://issues.jboss.org/browse/JBIDE-12896
Synchronized iteration over map entries in DefinitionContext.copy(boolean).
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java 2012-10-18
22:28:28 UTC (rev 44589)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java 2012-10-18
23:11:56 UTC (rev 44590)
@@ -85,52 +85,54 @@
ecopy.setRootContext(copy);
copy.extensions.add(ecopy);
}
- if(!clean) {
- copy.types.addAll(types);
- for (String qn: typeDefinitions.keySet()) {
- TypeDefinition d = typeDefinitions.get(qn);
- if(d.exists()) {
- copy.typeDefinitions.put(qn, d);
- } else {
- copy.types.remove(qn);
+ if(!clean) {
+ synchronized(this) {
+ copy.types.addAll(types);
+ for (String qn: typeDefinitions.keySet()) {
+ TypeDefinition d = typeDefinitions.get(qn);
+ if(d.exists()) {
+ copy.typeDefinitions.put(qn, d);
+ } else {
+ copy.types.remove(qn);
+ }
}
- }
- for (String qn: annotations.keySet()) {
- AnnotationDefinition d = annotations.get(qn);
- if(d.exists()) {
- copy.annotations.put(qn, d);
+ for (String qn: annotations.keySet()) {
+ AnnotationDefinition d = annotations.get(qn);
+ if(d.exists()) {
+ copy.annotations.put(qn, d);
+ }
}
- }
- copy.vetoedTypes.addAll(vetoedTypes);
+ copy.vetoedTypes.addAll(vetoedTypes);
- copy.packages.addAll(packages);
- for (String qn: packageDefinitions.keySet()) {
- PackageDefinition d = packageDefinitions.get(qn);
- if(d.exists()) {
- copy.packageDefinitions.put(qn, d);
- } else {
- packages.remove(qn);
+ copy.packages.addAll(packages);
+ for (String qn: packageDefinitions.keySet()) {
+ PackageDefinition d = packageDefinitions.get(qn);
+ if(d.exists()) {
+ copy.packageDefinitions.put(qn, d);
+ } else {
+ packages.remove(qn);
+ }
}
- }
- for (IPath p: resources.keySet()) {
- Set<String> set = resources.get(p);
- if(set != null) {
- Set<String> s1 = new HashSet<String>();
- s1.addAll(set);
- copy.resources.put(p, s1);
+ for (IPath p: resources.keySet()) {
+ Set<String> set = resources.get(p);
+ if(set != null) {
+ Set<String> s1 = new HashSet<String>();
+ s1.addAll(set);
+ copy.resources.put(p, s1);
+ }
}
- }
- for (IPath p: childPaths.keySet()) {
- Set<IPath> set = childPaths.get(p);
- if(set != null) {
- Set<IPath> s1 = new HashSet<IPath>();
- s1.addAll(set);
- copy.childPaths.put(p, s1);
+ for (IPath p: childPaths.keySet()) {
+ Set<IPath> set = childPaths.get(p);
+ if(set != null) {
+ Set<IPath> s1 = new HashSet<IPath>();
+ s1.addAll(set);
+ copy.childPaths.put(p, s1);
+ }
}
+ copy.beanXMLs.putAll(beanXMLs);
+ copy.dependencies = dependencies;
}
- copy.beanXMLs.putAll(beanXMLs);
- copy.dependencies = dependencies;
}
return copy;