Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2017-04-28 05:31:26 -0400
committerAndrey Loskutov2017-04-28 05:46:48 -0400
commitb115fd5bd86cacbffcbaaa7425af7cb14f792c91 (patch)
tree91f2a45dbcbe590bb2c4fcac23babbb89ee71f27
parent3e04a5f355a3414aa31e51577cde700108b4349e (diff)
downloadeclipse.platform.debug-I20170429-2000.tar.gz
eclipse.platform.debug-I20170429-2000.tar.xz
eclipse.platform.debug-I20170429-2000.zip
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.java23
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;
}
}

Back to the top