ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maart...@apache.org
Subject svn commit: r886303 - in /ant/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
Date Wed, 02 Dec 2009 21:13:22 GMT
Author: maartenc
Date: Wed Dec  2 21:13:21 2009
New Revision: 886303

URL: http://svn.apache.org/viewvc?rev=886303&view=rev
Log:
FIX: metadata lock files not always deleted from cache (IVY-1145) (thanks to Jason Trump)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=886303&r1=886302&r2=886303&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Wed Dec  2 21:13:21 2009
@@ -100,6 +100,7 @@
 - IMPROVEMENT: Trace a message when a property file referenced from the settings doesn't
exixts (IVY-1074)
 - IMPROVEMENT: use defaultconf in combination with defaultconfmapping (IVY-1135) (thanks
to Jon Schneider)
 
+- FIX: metadata lock files not always deleted from cache (IVY-1145) (thanks to Jason Trump)
 - FIX: FileSystem resolver with m2compatible=true throws error when publishing modules with
dotted organisation names (IVY-968)
 - FIX: ivy:retrieve sync="true" does nothing if first variable is optional (IVY-1142) (thanks
to Andreas Axelsson)
 - FIX: Latest Compatible Conflict Manager + Extra Attributes in Dependencies' IVY files ==
infinite loop (IVY-956)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java?rev=886303&r1=886302&r2=886303&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
Wed Dec  2 21:13:21 2009
@@ -881,67 +881,68 @@
             Message.error("impossible to acquire lock for " + mrid);
             return null;
         }
+
+        BackupResourceDownloader backupDownloader = new BackupResourceDownloader(downloader);
+
+        try {
+            if (!moduleArtifact.isMetadata()) {
+                // the descriptor we are trying to cache is a default one, not much to do
+                // just make sure the old artifacts are deleted...
+                if (isChanging(dd, mrid, options)) {
+                    long repoLastModified = mdRef.getLastModified();
         
-        if (!moduleArtifact.isMetadata()) {
-            // the descriptor we are trying to cache is a default one, not much to do
-            // just make sure the old artifacts are deleted...
-            if (isChanging(dd, mrid, options)) {
-                long repoLastModified = mdRef.getLastModified();
-    
-                Artifact transformedArtifact = NameSpaceHelper.transform(
-                    moduleArtifact, options.getNamespace().getToSystemTransformer());
-                ArtifactOrigin origin = getSavedArtifactOrigin(transformedArtifact);
-                File artFile = getArchiveFileInCache(transformedArtifact, origin, false);
-                if (artFile.exists() && repoLastModified > artFile.lastModified())
{
-                    // artifacts have changed, they should be downloaded again
-                    Message.verbose(mrid + " has changed: deleting old artifacts");
-                    Message.debug("deleting " + artFile);
-                    if (!artFile.delete()) {
-                        Message.error("Couldn't delete outdated artifact from cache: " +
artFile);
-                        return null;
+                    Artifact transformedArtifact = NameSpaceHelper.transform(
+                        moduleArtifact, options.getNamespace().getToSystemTransformer());
+                    ArtifactOrigin origin = getSavedArtifactOrigin(transformedArtifact);
+                    File artFile = getArchiveFileInCache(transformedArtifact, origin, false);
+                    if (artFile.exists() && repoLastModified > artFile.lastModified())
{
+                        // artifacts have changed, they should be downloaded again
+                        Message.verbose(mrid + " has changed: deleting old artifacts");
+                        Message.debug("deleting " + artFile);
+                        if (!artFile.delete()) {
+                            Message.error("Couldn't delete outdated artifact from cache:
" + artFile);
+                            return null;
+                        }
+                        removeSavedArtifactOrigin(transformedArtifact);
                     }
-                    removeSavedArtifactOrigin(transformedArtifact);
                 }
+                return null;
             }
-            return null;
-        }
-        
-        // now let's see if we can find it in cache and if it is up to date
-        ResolvedModuleRevision rmr = doFindModuleInCache(mrid, options, null);
-        if (rmr != null) {
-            if (rmr.getDescriptor().isDefault() && rmr.getResolver() != resolver)
{
-                Message.verbose("\t" + getName() + ": found revision in cache: " + mrid
-                    + " (resolved by " + rmr.getResolver().getName()
-                    + "): but it's a default one, maybe we can find a better one");
-            } else {
-                if (!isCheckmodified(dd, mrid, options) && !isChanging(dd, mrid,
options)) {
-                    Message.verbose("\t" + getName() + ": revision in cache: " + mrid);
-                    rmr.getReport().setSearched(true);
-                    return rmr;
-                }
-                long repLastModified = mdRef.getLastModified();
-                long cacheLastModified = rmr.getDescriptor().getLastModified();
-                if (!rmr.getDescriptor().isDefault() && repLastModified <= cacheLastModified)
{
-                    Message.verbose("\t" + getName() + ": revision in cache (not updated):
"
-                        + mrid);
-                    rmr.getReport().setSearched(true);
-                    return rmr;
+            
+            // now let's see if we can find it in cache and if it is up to date
+            ResolvedModuleRevision rmr = doFindModuleInCache(mrid, options, null);
+            if (rmr != null) {
+                if (rmr.getDescriptor().isDefault() && rmr.getResolver() != resolver)
{
+                    Message.verbose("\t" + getName() + ": found revision in cache: " + mrid
+                        + " (resolved by " + rmr.getResolver().getName()
+                        + "): but it's a default one, maybe we can find a better one");
                 } else {
-                    Message.verbose("\t" + getName() + ": revision in cache is not up to
date: "
-                        + mrid);
-                    if (isChanging(dd, mrid, options)) {
-                        // ivy file has been updated, we should see if it has a new publication
-                        // date to see if a new download is required (in case the dependency
is
-                        // a changing one)
-                        cachedPublicationDate = 
-                            rmr.getDescriptor().getResolvedPublicationDate();
+                    if (!isCheckmodified(dd, mrid, options) && !isChanging(dd, mrid,
options)) {
+                        Message.verbose("\t" + getName() + ": revision in cache: " + mrid);
+                        rmr.getReport().setSearched(true);
+                        return rmr;
+                    }
+                    long repLastModified = mdRef.getLastModified();
+                    long cacheLastModified = rmr.getDescriptor().getLastModified();
+                    if (!rmr.getDescriptor().isDefault() && repLastModified <=
cacheLastModified) {
+                        Message.verbose("\t" + getName() + ": revision in cache (not updated):
"
+                            + mrid);
+                        rmr.getReport().setSearched(true);
+                        return rmr;
+                    } else {
+                        Message.verbose("\t" + getName() + ": revision in cache is not up
to date: "
+                            + mrid);
+                        if (isChanging(dd, mrid, options)) {
+                            // ivy file has been updated, we should see if it has a new publication
+                            // date to see if a new download is required (in case the dependency
is
+                            // a changing one)
+                            cachedPublicationDate = 
+                                rmr.getDescriptor().getResolvedPublicationDate();
+                        }
                     }
                 }
             }
-        }
         
-        BackupResourceDownloader backupDownloader = new BackupResourceDownloader(downloader);
-        try {
             Artifact originalMetadataArtifact = getOriginalMetadataArtifact(moduleArtifact);
             // now download module descriptor and parse it
             report = download(



Mime
View raw message