Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 99800 Details for
Bug 231643
ConcurrentModificationException during shutdown
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
proposed patch
patch-231643.txt (text/plain), 3.62 KB, created by
Brian Vosburgh
on 2008-05-12 15:44:21 EDT
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Brian Vosburgh
Created:
2008-05-12 15:44:21 EDT
Size:
3.62 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jpt.core >Index: src/org/eclipse/jpt/core/internal/GenericJpaFile.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaFile.java,v >retrieving revision 1.8 >diff -u -r1.8 GenericJpaFile.java >--- src/org/eclipse/jpt/core/internal/GenericJpaFile.java 25 Apr 2008 20:15:04 -0000 1.8 >+++ src/org/eclipse/jpt/core/internal/GenericJpaFile.java 12 May 2008 19:43:22 -0000 >@@ -9,10 +9,10 @@ > ******************************************************************************/ > package org.eclipse.jpt.core.internal; > >-import java.util.HashMap; >+import java.util.Hashtable; > import java.util.Iterator; >-import java.util.Map; > import java.util.Set; >+ > import org.eclipse.core.resources.IFile; > import org.eclipse.jdt.core.ElementChangedEvent; > import org.eclipse.jpt.core.JpaFile; >@@ -35,15 +35,15 @@ > protected final ResourceModel resourceModel; > > /** >- * The context model root node represented by this JPA file >+ * The context model root nodes represented by this JPA file > */ >- protected final Map<Object, JpaStructureNode> rootStructureNodes; >+ protected final Hashtable<Object, JpaStructureNode> rootStructureNodes; > > public GenericJpaFile(JpaProject jpaProject, IFile file, ResourceModel resourceModel) { > super(jpaProject); > this.file = file; > this.resourceModel = resourceModel; >- this.rootStructureNodes = new HashMap<Object, JpaStructureNode>(); >+ this.rootStructureNodes = new Hashtable<Object, JpaStructureNode>(); > } > > @Override >@@ -71,17 +71,22 @@ > public int rootStructureNodesSize() { > return this.rootStructureNodes.size(); > } >- >+ >+ // TODO move events outside of 'synchronized' block? >+ // need fireItemReplaced(String, Object, Object) for Collection? > public void addRootStructureNode(Object key, JpaStructureNode rootStructureNode) { >- if (this.rootStructureNodes.get(key) == rootStructureNode) { >- return; >- } >- if (this.rootStructureNodes.containsKey(key)) { >- JpaStructureNode removedStructureNode = this.rootStructureNodes.remove(key); >- fireItemRemoved(JpaFile.ROOT_STRUCTURE_NODES_COLLECTION, removedStructureNode); >+ synchronized (this.rootStructureNodes) { >+ JpaStructureNode node = this.rootStructureNodes.get(key); >+ if (node == rootStructureNode) { >+ return; // no duplicates >+ } >+ if (node != null) { >+ this.rootStructureNodes.remove(key); >+ this.fireItemRemoved(JpaFile.ROOT_STRUCTURE_NODES_COLLECTION, node); >+ } >+ this.rootStructureNodes.put(key, rootStructureNode); >+ this.fireItemAdded(JpaFile.ROOT_STRUCTURE_NODES_COLLECTION, rootStructureNode); > } >- this.rootStructureNodes.put(key, rootStructureNode); >- fireItemAdded(JpaFile.ROOT_STRUCTURE_NODES_COLLECTION, rootStructureNode); > } > > public void removeRootStructureNode(Object key) { >@@ -99,16 +104,19 @@ > return null; > } > >+ protected Iterator<Object> rootStructureNodeKeys() { >+ return new CloneIterator<Object>(this.rootStructureNodes.keySet()); >+ } >+ > public String getResourceType() { > return getResourceModel().getResourceType(); > } > > public void dispose() { > getResourceModel().dispose(); >- >- Set<Object> keys = this.rootStructureNodes.keySet(); >- for (Object key : keys) { >- removeRootStructureNode(key); >+ >+ for (Iterator<Object> stream = this.rootStructureNodeKeys(); stream.hasNext(); ) { >+ this.removeRootStructureNode(stream.next()); > } > } > >@@ -123,4 +131,5 @@ > sb.append(getResourceType()); > sb.append(")"); > } >+ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 231643
:
99794
| 99800