You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ma...@apache.org on 2010/10/18 23:48:42 UTC

svn commit: r1024027 - in /ant/ivy/core/trunk: ./ src/java/org/apache/ivy/plugins/resolver/util/ test/java/org/apache/ivy/plugins/resolver/util/ test/repositories/IVY-1238/ test/repositories/IVY-1238/ivy-org/ test/repositories/IVY-1238/ivy-org/modA/ te...

Author: maartenc
Date: Mon Oct 18 21:48:41 2010
New Revision: 1024027

URL: http://svn.apache.org/viewvc?rev=1024027&view=rev
Log:
FIX: Can not use a v[revision] in an artifact pattern of a filesystem resolver (IVY-1238)

Added:
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/util/
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/util/ResolverHelperTest.java
    ant/ivy/core/trunk/test/repositories/IVY-1238/
    ant/ivy/core/trunk/test/repositories/IVY-1238/ivy-org/
    ant/ivy/core/trunk/test/repositories/IVY-1238/ivy-org/modA/
    ant/ivy/core/trunk/test/repositories/IVY-1238/ivy-org/modA/v1.0/
    ant/ivy/core/trunk/test/repositories/IVY-1238/ivy-org/modA/v1.0/ivy.xml
    ant/ivy/core/trunk/test/repositories/IVY-1238/ivy-org/modA/v2.0/
    ant/ivy/core/trunk/test/repositories/IVY-1238/ivy-org/modA/v2.0/ivy.xml
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=1024027&r1=1024026&r2=1024027&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Mon Oct 18 21:48:41 2010
@@ -113,6 +113,7 @@ for detailed view of each issue, please 
 	
    trunk
 =====================================
+- FIX: Can not use a v[revision] in an artifact pattern of a filesystem resolver (IVY-1238)
 - FIX: Cached ivy.xml is invalid if the description contains the ampersand entity (&) (IVY-1237)
 - FIX: Couldn't authenticate against sites having the same address as the proxy server (IVY-1234)
 - FIX: OutOfMemoryError when uploading large files using commons-httpclient (IVY-1197) (thanks to Torkild U. Resheim)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java?rev=1024027&r1=1024026&r2=1024027&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java Mon Oct 18 21:48:41 2010
@@ -73,13 +73,11 @@ public final class ResolverHelper {
                         namePattern = pattern.substring(slashIndex + 1);
                     }
                     namePattern = namePattern.replaceAll("\\.", "\\\\.");
-                    String acceptNamePattern = ".*?"
-                            + IvyPatternHelper.substituteToken(namePattern, token, "([^" + fileSep
-                                    + "]+)") + "($|" + fileSep + ".*)";
-                    Pattern p = Pattern.compile(acceptNamePattern);
+                    namePattern = IvyPatternHelper.substituteToken(namePattern, token, "(.+)");
+                    Pattern p = Pattern.compile(namePattern);
                     for (Iterator iter = all.iterator(); iter.hasNext();) {
                         String path = (String) iter.next();
-                        Matcher m = p.matcher(path);
+                        Matcher m = p.matcher(path.substring(root.length() + 1));
                         if (m.matches()) {
                             String value = m.group(1);
                             ret.add(value);

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/util/ResolverHelperTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/util/ResolverHelperTest.java?rev=1024027&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/util/ResolverHelperTest.java (added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/util/ResolverHelperTest.java Mon Oct 18 21:48:41 2010
@@ -0,0 +1,41 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.resolver.util;
+
+import java.io.File;
+import java.util.Arrays;
+
+import org.apache.ivy.plugins.repository.file.FileRepository;
+
+import junit.framework.TestCase;
+
+public class ResolverHelperTest extends TestCase {
+
+    public void testListTokenValuesForIvy1238() {
+        FileRepository rep = new FileRepository(new File(".").getAbsoluteFile());
+        String[] revisions = ResolverHelper.listTokenValues(rep, "test/repositories/IVY-1238/ivy-org/modA/v[revision]/ivy.xml", "revision");
+
+        assertNotNull(revisions);
+        assertEquals(2, revisions.length);
+        
+        Arrays.sort(revisions);
+        assertEquals("1.0", revisions[0]);
+        assertEquals("2.0", revisions[1]);
+    }
+    
+}

Added: ant/ivy/core/trunk/test/repositories/IVY-1238/ivy-org/modA/v1.0/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1238/ivy-org/modA/v1.0/ivy.xml?rev=1024027&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/IVY-1238/ivy-org/modA/v1.0/ivy.xml (added)
+++ ant/ivy/core/trunk/test/repositories/IVY-1238/ivy-org/modA/v1.0/ivy.xml Mon Oct 18 21:48:41 2010
@@ -0,0 +1,23 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivy-module version="1.0">
+    <info organisation="myorg" module="modA" revision="1.0" />
+    <publications />
+    <dependencies />
+</ivy-module>

Added: ant/ivy/core/trunk/test/repositories/IVY-1238/ivy-org/modA/v2.0/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1238/ivy-org/modA/v2.0/ivy.xml?rev=1024027&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/IVY-1238/ivy-org/modA/v2.0/ivy.xml (added)
+++ ant/ivy/core/trunk/test/repositories/IVY-1238/ivy-org/modA/v2.0/ivy.xml Mon Oct 18 21:48:41 2010
@@ -0,0 +1,23 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivy-module version="1.0">
+    <info organisation="myorg" module="modA" revision="2.0" />
+    <publications />
+    <dependencies />
+</ivy-module>