Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-05-12 14:55:28 +0000
committerMichael Valenta2004-05-12 14:55:28 +0000
commit373d37da19bc6de2dd691e9296d7c8dae8cdb875 (patch)
tree33a4d017ae9e85a66db78f747e341208be6515d8
parenta4c6fef514de6e3a0015ea0855eca1b19ac3a499 (diff)
downloadeclipse.platform.team-373d37da19bc6de2dd691e9296d7c8dae8cdb875.tar.gz
eclipse.platform.team-373d37da19bc6de2dd691e9296d7c8dae8cdb875.tar.xz
eclipse.platform.team-373d37da19bc6de2dd691e9296d7c8dae8cdb875.zip
Bug 53930: Error while clearing cache directory on startup
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java31
1 files changed, 14 insertions, 17 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java
index 98b924671..ed43dc298 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java
@@ -55,12 +55,7 @@ public class ResourceVariantCache {
public static synchronized void enableCaching(String cacheId) {
if (isCachingEnabled(cacheId)) return;
ResourceVariantCache cache = new ResourceVariantCache(cacheId);
- try {
- cache.createCacheDirectory();
- } catch (TeamException e) {
- // Log the exception and continue
- TeamPlugin.log(e);
- }
+ cache.createCacheDirectory();
caches.put(cacheId, cache);
}
@@ -89,12 +84,7 @@ public class ResourceVariantCache {
return;
}
caches.remove(cacheId);
- try {
- cache.deleteCacheDirectory();
- } catch (TeamException e) {
- // Log the exception and continue
- TeamPlugin.log(e);
- }
+ cache.deleteCacheDirectory();
}
/**
@@ -163,21 +153,28 @@ public class ResourceVariantCache {
cacheEntries.remove(id);
}
- private synchronized void createCacheDirectory() throws TeamException {
+ private synchronized void createCacheDirectory() {
IPath cacheLocation = getCachePath();
File file = cacheLocation.toFile();
if (file.exists()) {
- deleteFile(file);
+ try {
+ deleteFile(file);
+ } catch (TeamException e) {
+ // Check to see if were in an acceptable state
+ if (file.exists() && (!file.isDirectory() || file.listFiles().length != 0)) {
+ TeamPlugin.log(e);
+ }
+ }
}
- if (! file.mkdirs()) {
- throw new TeamException(Policy.bind("RemoteContentsCache.fileError", file.getAbsolutePath())); //$NON-NLS-1$
+ if (! file.exists() && ! file.mkdirs()) {
+ TeamPlugin.log(new TeamException(Policy.bind("RemoteContentsCache.fileError", file.getAbsolutePath()))); //$NON-NLS-1$
}
cacheEntries = new HashMap();
lastCacheCleanup = -1;
cacheDirSize = 0;
}
- private synchronized void deleteCacheDirectory() throws TeamException {
+ private synchronized void deleteCacheDirectory() {
cacheEntries = null;
lastCacheCleanup = -1;
cacheDirSize = 0;

Back to the top