Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2011-05-10 03:14:05 +0000
committerPascal Rapicault2011-05-10 03:14:05 +0000
commit188a385d34c350e987059dd0a4d5c9223696310e (patch)
tree4d72c727f0994c60be562590047b092a3edccda7 /bundles/org.eclipse.equinox.p2.repository/src
parent3a7af79bbba8f1bd615d19ac5dafd0113060eedc (diff)
downloadrt.equinox.p2-188a385d34c350e987059dd0a4d5c9223696310e.tar.gz
rt.equinox.p2-188a385d34c350e987059dd0a4d5c9223696310e.tar.xz
rt.equinox.p2-188a385d34c350e987059dd0a4d5c9223696310e.zip
Bug 324200 - CacheManager sets lastModified incorrectly when downloading files
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.repository/src')
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java
index ecdd62d66..234b974a7 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java
@@ -162,7 +162,7 @@ public class CacheManager {
// There is a jar, and it should be used - cache is stale if it is xml based or
// if older (irrespective of jar or xml).
// Bug 269588 - also stale if remote reports 0
- stale = lastModifiedRemote > lastModified || (name != null && name.endsWith(XML_EXTENSION) || lastModifiedRemote <= 0);
+ stale = lastModifiedRemote != lastModified || (name != null && name.endsWith(XML_EXTENSION) || lastModifiedRemote <= 0);
} else {
// Also need to check remote XML file, and handle cancel, and errors
// (Status is reported based on finding the XML file as giving up on certain errors
@@ -192,7 +192,7 @@ public class CacheManager {
// There is an xml, and it should be used - cache is stale if it is jar based or
// if older (irrespective of jar or xml).
// bug 269588 - server may return 0 when file exists - assume it is stale
- stale = lastModifiedRemote > lastModified || (name != null && name.endsWith(JAR_EXTENSION) || lastModifiedRemote <= 0);
+ stale = lastModifiedRemote != lastModified || (name != null && name.endsWith(JAR_EXTENSION) || lastModifiedRemote <= 0);
useExtension = XML_EXTENSION;
remoteFile = xmlLocation;
}
@@ -344,8 +344,13 @@ public class CacheManager {
if (result.isOK()) {
if (cacheFile.exists())
safeDelete(cacheFile);
- if (tempFile.renameTo(cacheFile))
+ if (tempFile.renameTo(cacheFile)) {
+ if (lastModifiedRemote != -1 && lastModifiedRemote != 0) {
+ //local cache file should have the same lastModified as the server's file. bug 324200
+ cacheFile.setLastModified(lastModifiedRemote);
+ }
return;
+ }
result = new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.CacheManage_ErrorRenamingCache, new Object[] {remoteFile.toString(), tempFile.getAbsolutePath(), cacheFile.getAbsolutePath()}));
}

Back to the top