Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2006-08-15 13:41:18 -0400
committerThomas Watson2006-08-15 13:41:18 -0400
commit159b2c862ae5db61c20f394dadf865e3275613ba (patch)
treee7093eab6ffbc577234af66c8281272ba664b9c8
parenta9f15a3e45410c9660c982d17f6685405a5bb984 (diff)
downloadrt.equinox.framework-159b2c862ae5db61c20f394dadf865e3275613ba.tar.gz
rt.equinox.framework-159b2c862ae5db61c20f394dadf865e3275613ba.tar.xz
rt.equinox.framework-159b2c862ae5db61c20f394dadf865e3275613ba.zip
Bug 153699 MRUBundleFileList tries to remove null bundle fileR32x_v20060815
-rw-r--r--bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleFile.java21
1 files changed, 14 insertions, 7 deletions
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleFile.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleFile.java
index 10808cc97..0651ff372 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleFile.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleFile.java
@@ -86,7 +86,7 @@ public class ZipBundleFile extends BundleFile {
* @return an open ZipFile for this bundle
* @throws IOException
*/
- protected ZipFile getZipFile() throws IOException {
+ protected synchronized ZipFile getZipFile() throws IOException {
if (closed) {
mruList.add(this);
zipFile = basicOpen();
@@ -96,6 +96,13 @@ public class ZipBundleFile extends BundleFile {
return zipFile;
}
+ /**
+ * Returns a ZipEntry for the bundle file. Must be called while synchronizing on this object.
+ * This method does not ensure that the ZipFile is opened. Callers may need to call getZipfile() prior to calling this
+ * method.
+ * @param path the path to an entry
+ * @return a ZipEntry or null if the entry does not exist
+ */
protected ZipEntry getZipEntry(String path) {
if (path.length() > 0 && path.charAt(0) == '/')
path = path.substring(1);
@@ -116,7 +123,7 @@ public class ZipBundleFile extends BundleFile {
* of <code>null</code> is returned if the directory to extract does
* not exist or if content extraction is not supported.
*/
- protected File extractDirectory(String dirName) {
+ protected synchronized File extractDirectory(String dirName) {
if (!checkedOpen())
return null;
Enumeration entries = zipFile.entries();
@@ -140,7 +147,7 @@ public class ZipBundleFile extends BundleFile {
return bundledata.getExtractFile(path);
}
- public File getFile(String entry, boolean nativeCode) {
+ public synchronized File getFile(String entry, boolean nativeCode) {
if (!checkedOpen())
return null;
ZipEntry zipEntry = getZipEntry(entry);
@@ -192,7 +199,7 @@ public class ZipBundleFile extends BundleFile {
return null;
}
- public boolean containsDir(String dir) {
+ public synchronized boolean containsDir(String dir) {
if (!checkedOpen())
return false;
if (dir == null)
@@ -223,7 +230,7 @@ public class ZipBundleFile extends BundleFile {
return false;
}
- public BundleEntry getEntry(String path) {
+ public synchronized BundleEntry getEntry(String path) {
if (!checkedOpen())
return null;
ZipEntry zipEntry = getZipEntry(path);
@@ -240,7 +247,7 @@ public class ZipBundleFile extends BundleFile {
}
- public Enumeration getEntryPaths(String path) {
+ public synchronized Enumeration getEntryPaths(String path) {
if (!checkedOpen())
return null;
if (path == null)
@@ -273,7 +280,7 @@ public class ZipBundleFile extends BundleFile {
return vEntries.size() == 0 ? null : vEntries.elements();
}
- public void close() throws IOException {
+ public synchronized void close() throws IOException {
if (!closed) {
closed = true;
zipFile.close();

Back to the top