diff options
author | Andrey Loskutov | 2017-04-28 09:31:26 +0000 |
---|---|---|
committer | Andrey Loskutov | 2017-04-28 09:46:48 +0000 |
commit | b115fd5bd86cacbffcbaaa7425af7cb14f792c91 (patch) | |
tree | 91f2a45dbcbe590bb2c4fcac23babbb89ee71f27 | |
parent | 3e04a5f355a3414aa31e51577cde700108b4349e (diff) | |
download | eclipse.platform.debug-b115fd5bd86cacbffcbaaa7425af7cb14f792c91.tar.gz eclipse.platform.debug-b115fd5bd86cacbffcbaaa7425af7cb14f792c91.tar.xz eclipse.platform.debug-b115fd5bd86cacbffcbaaa7425af7cb14f792c91.zip |
Bug 515941 - ConcurrentModificationException inY20170504-1000I20170503-2000I20170502-2000I20170501-2000I20170430-2000I20170429-2000I20170429-1330I20170429-1230I20170428-2000I20170428-0830I20170428-0700I20170428-0550
ExternalArchiveSourceContainer
Don't try to dispose while the search is running, don't continue with
search if container was disposed.
Change-Id: Ida0e5e07a5cafe5bdab4096e991bacb13c8872bd
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r-- | org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ExternalArchiveSourceContainer.java | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ExternalArchiveSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ExternalArchiveSourceContainer.java index bd1858a25..de702e7c5 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ExternalArchiveSourceContainer.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ExternalArchiveSourceContainer.java @@ -42,10 +42,11 @@ import com.ibm.icu.text.MessageFormat; */ public class ExternalArchiveSourceContainer extends AbstractSourceContainer { - private boolean fDetectRoots = false; - private Set<String> fPotentialRoots = null; + private boolean fDisposed; + private boolean fDetectRoots; + private Set<String> fPotentialRoots; private List<String> fRoots = new ArrayList<String>(); - private String fArchivePath = null; + private String fArchivePath; /** * Unique identifier for the external archive source container type * (value <code>org.eclipse.debug.core.containerType.externalArchive</code>). @@ -79,6 +80,9 @@ public class ExternalArchiveSourceContainer extends AbstractSourceContainer { public Object[] findSourceElements(String name) throws CoreException { String newname = name.replace('\\', '/'); ZipFile file = getArchive(); + if (file == null) { + return EMPTY; + } // NOTE: archive can be closed between get (above) and synchronized block (below) synchronized (file) { boolean isQualfied = newname.indexOf('/') > 0; @@ -138,7 +142,10 @@ public class ExternalArchiveSourceContainer extends AbstractSourceContainer { * @return the {@link ZipEntry} with the given name or <code>null</code> * @exception CoreException if an exception occurs while detecting the root */ - private ZipEntry searchRoots(ZipFile file, String name) throws CoreException { + private synchronized ZipEntry searchRoots(ZipFile file, String name) throws CoreException { + if (fDisposed) { + return null; + } if (fPotentialRoots == null) { fPotentialRoots = new HashSet<String>(); fPotentialRoots.add(""); //$NON-NLS-1$ @@ -208,7 +215,10 @@ public class ExternalArchiveSourceContainer extends AbstractSourceContainer { * * @throws CoreException if unable to access the archive */ - private ZipFile getArchive() throws CoreException { + private synchronized ZipFile getArchive() throws CoreException { + if (fDisposed) { + return null; + } try { return SourceLookupUtils.getZipFile(fArchivePath); } catch (IOException e) { @@ -255,11 +265,12 @@ public class ExternalArchiveSourceContainer extends AbstractSourceContainer { } @Override - public void dispose() { + public synchronized void dispose() { super.dispose(); if (fPotentialRoots != null) { fPotentialRoots.clear(); } fRoots.clear(); + fDisposed = true; } } |