ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maart...@apache.org
Subject svn commit: r778247 - in /ant/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java
Date Sun, 24 May 2009 22:30:29 GMT
Author: maartenc
Date: Sun May 24 22:30:29 2009
New Revision: 778247

URL: http://svn.apache.org/viewvc?rev=778247&view=rev
Log:
FIX: Ibiblio resolver throws IndexOutOfBoundsException when using snapshot versions with usepoms='false'
(IVY-1028)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=778247&r1=778246&r2=778247&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Sun May 24 22:30:29 2009
@@ -87,6 +87,7 @@
 	
    trunk
 =====================================
+- FIX: Ibiblio resolver throws IndexOutOfBoundsException when using snapshot versions with
usepoms='false' (IVY-1028)
 - FIX: Wrong BuildException messages (findmodules) (IVY-1056)
 - FIX: PomModuleDescriptorBuilder does not resolve ejb type dependencies to jar extension
(IVY-1058) (thanks to Andrey Lomakin)
 - FIX: Ivy doesn't handle maven dependencies with type 'test-jar' correctly (IVY-1066)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java?rev=778247&r1=778246&r2=778247&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java Sun May
24 22:30:29 2009
@@ -130,8 +130,7 @@
         String rev = findSnapshotVersion(mrid);
         if (rev != null) {
             // replace the revision token in file name with the resolved revision
-            String pattern = (String) getArtifactPatterns().get(0);
-            pattern = pattern.replaceFirst("\\-\\[revision\\]", "-" + rev);
+            String pattern = getWholePattern().replaceFirst("\\-\\[revision\\]", "-" + rev);
             return findResourceUsingPattern(mrid, pattern, artifact,
                 getDefaultRMDParser(artifact.getModuleRevisionId().getModuleId()), date);
         }
@@ -148,8 +147,7 @@
             Message.verbose("[" + rev + "] " + mrid);
 
             // replace the revision token in file name with the resolved revision
-            String pattern = (String) getIvyPatterns().get(0);
-            pattern = pattern.replaceFirst("\\-\\[revision\\]", "-" + rev);
+            String pattern = getWholePattern().replaceFirst("\\-\\[revision\\]", "-" + rev);
             return findResourceUsingPattern(mrid, pattern,
                 DefaultArtifact.newPomArtifact(
                     mrid, data.getDate()), getRMDParser(dd, data), data.getDate());
@@ -162,8 +160,7 @@
             return null;
         }
         
-        String pattern = (String) getIvyPatterns().get(0);
-        if (shouldUseMavenMetadata(pattern)) {
+        if (shouldUseMavenMetadata(getWholePattern())) {
             InputStream metadataStream = null;
             try {
                 String metadataLocation = IvyPatternHelper.substitute(
@@ -337,40 +334,37 @@
         
         // let's see if we should use maven metadata for this listing...
         if (IvyPatternHelper.REVISION_KEY.equals(token) 
-                && isM2compatible()
-                && isUseMavenMetadata()) {
-            if (((String) getIvyPatterns().get(0)).endsWith(M2_PER_MODULE_PATTERN)) {
-                // now we must use metadata if available
+                && shouldUseMavenMetadata(getWholePattern())) {
+            // now we must use metadata if available
+            /*
+             * we substitute tokens with ext token only in the m2 per module pattern, to
match
+             * has has been done in the given pattern
+             */
+            String partiallyResolvedM2PerModulePattern = IvyPatternHelper.substituteTokens(
+                M2_PER_MODULE_PATTERN, 
+                Collections.singletonMap(IvyPatternHelper.EXT_KEY, "pom"));
+            if (pattern.endsWith(partiallyResolvedM2PerModulePattern)) {
                 /*
-                 * we substitute tokens with ext token only in the m2 per module pattern,
to match
-                 * has has been done in the given pattern
+                 * the given pattern already contain resolved org and module, we just have
to
+                 * replace the per module pattern at the end by 'maven-metadata.xml' to have
the
+                 * maven metadata file location
                  */
-                String partiallyResolvedM2PerModulePattern = IvyPatternHelper.substituteTokens(
-                    M2_PER_MODULE_PATTERN, 
-                    Collections.singletonMap(IvyPatternHelper.EXT_KEY, "pom"));
-                if (pattern.endsWith(partiallyResolvedM2PerModulePattern)) {
-                    /*
-                     * the given pattern already contain resolved org and module, we just
have to
-                     * replace the per module pattern at the end by 'maven-metadata.xml'
to have the
-                     * maven metadata file location
-                     */
-                    String metadataLocation = pattern.substring(0, pattern
-                        .lastIndexOf(partiallyResolvedM2PerModulePattern))
-                        + "maven-metadata.xml";
-                    List revs = listRevisionsWithMavenMetadata(getRepository(), metadataLocation);
-                    if (revs != null) {
-                        return (String[]) revs.toArray(new String[revs.size()]);
-                    }
-                } else {
-                    /*
-                     * this is probably because the given pattern has been substituted with
jar ext,
-                     * if this resolver has optional module descriptors. But since we have
to use
-                     * maven metadata, we don't care about this case, maven metadata has
already
-                     * been used when looking for revisions with the pattern substituted
with
-                     * ext=xml for the "ivy" pattern.
-                     */  
-                    return new String[0];
+                String metadataLocation = pattern.substring(0, pattern
+                    .lastIndexOf(partiallyResolvedM2PerModulePattern))
+                    + "maven-metadata.xml";
+                List revs = listRevisionsWithMavenMetadata(getRepository(), metadataLocation);
+                if (revs != null) {
+                    return (String[]) revs.toArray(new String[revs.size()]);
                 }
+            } else {
+                /*
+                 * this is probably because the given pattern has been substituted with jar
ext,
+                 * if this resolver has optional module descriptors. But since we have to
use
+                 * maven metadata, we don't care about this case, maven metadata has already
+                 * been used when looking for revisions with the pattern substituted with
+                 * ext=xml for the "ivy" pattern.
+                 */  
+                return new String[0];
             }
         }
         return super.listTokenValues(pattern, token);
@@ -478,8 +472,7 @@
     
     protected void findTokenValues(Collection names, List patterns, Map tokenValues, String
token) {
         if (IvyPatternHelper.REVISION_KEY.equals(token)) {
-            String pattern = (String) patterns.get(0);
-            if (shouldUseMavenMetadata(pattern)) {
+            if (shouldUseMavenMetadata(getWholePattern())) {
                 List revs = listRevisionsWithMavenMetadata(getRepository(), tokenValues);
                 if (revs != null) {
                     names.addAll(filterNames(revs));



Mime
View raw message