maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ogusa...@apache.org
Subject svn commit: r741607 - /maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java
Date Fri, 06 Feb 2009 16:08:31 GMT
Author: ogusakov
Date: Fri Feb  6 16:08:31 2009
New Revision: 741607

URL: http://svn.apache.org/viewvc?rev=741607&view=rev
Log:
[MERCURY-89] adjusted for classifier in the file name

Modified:
    maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java

Modified: maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java?rev=741607&r1=741606&r2=741607&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java
(original)
+++ maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java
Fri Feb  6 16:08:31 2009
@@ -57,6 +57,7 @@
 import org.apache.maven.mercury.repository.api.RepositoryException;
 import org.apache.maven.mercury.repository.api.RepositoryReader;
 import org.apache.maven.mercury.util.FileUtil;
+import org.apache.maven.mercury.util.Util;
 import org.codehaus.plexus.lang.DefaultLanguage;
 import org.codehaus.plexus.lang.Language;
 
@@ -406,7 +407,7 @@
     }
 
     // ---------------------------------------------------------------------------------------------------------------
-    private static boolean findLatestSnapshot( ArtifactBasicMetadata bmd, final ArtifactLocation
loc, AbstractRepOpResult res )
+    private static boolean findLatestSnapshot( final ArtifactBasicMetadata bmd, final ArtifactLocation
loc, AbstractRepOpResult res )
     {
         File binary = new File( loc.getAbsPath() );
 
@@ -416,19 +417,21 @@
         // no real SNAPSHOT file, let's try to find one
         File gavDir = new File( loc.getAbsGavPath() );
         
-        final String regEx = Artifact.SNAPSHOT_TS_REGEX+"\\."+bmd.getCheckedType();
+        String classifier = Util.isEmpty( bmd.getClassifier() ) ? "" : '-'+bmd.getClassifier();
+        
+        final String regEx = Artifact.SNAPSHOT_TS_REGEX + classifier + "\\."+bmd.getCheckedType();
         
         final TreeSet<String> ts = new TreeSet<String>( new VersionComparator()
);
         
+        final int pos = bmd.getArtifactId().length() + 1;
+        
         File[] files = gavDir.listFiles( new FilenameFilter()
                                         {
                                             public boolean accept( File dir, String name
)
                                             {
                                                 if( name.matches( regEx ) )
                                                 {
-                                                    int pos = loc.getBaseName().length();
-                                                    
-                                                    String ver = name.substring( pos+1, name.lastIndexOf(
'.' ) );
+                                                    String ver = name.substring( pos, name.lastIndexOf(
'.' ) );
                                                     
                                                     ts.add( ver );
                                                     



Mime
View raw message