Author: xavier
Date: Fri Jul  4 00:25:37 2008
New Revision: 673934

URL: http://svn.apache.org/viewvc?rev=673934&view=rev
Log:
FIX: Maven version ranges with ( ) are not supported (IVY-678) (thanks to 
Michael Kebe)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/version/VersionRangeMatcher.java
    
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/version/VersionRangeMatcherTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=673934&r1=673933&r2=673934&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Fri Jul  4 00:25:37 2008
@@ -35,6 +35,7 @@
        Matt Inger
        Anders Janmyr
        Christer Jonsson
+       Michael Kebe
        Matthias Kilian
        Gregory Kisling
        Tat Leung
@@ -90,6 +91,7 @@
 - IMPROVEMENT: Change allownomd and skipbuildwithoutivy into a more 
semantically correct name (IVY-297)
 - IMPROVEMENT: Smarter determination if an expression is exact or not for 
RegexpPatternMatcher and GlobPatternMatcher
 
+- FIX: Maven version ranges with ( ) are not supported (IVY-678) (thanks to 
Michael Kebe)
 - FIX: Ignore maven metadata files when listing revisions (IVY-765)
 - FIX: haltonmissing on publish task does not prevent the other files to be 
published, even with an atomic publisher (IVY-656)
 - FIX: Transitive dependencies resolves incorrectly when different modules 
uses the same dependency with different configurations in the same build 
(IVY-541)

Modified: 
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/version/VersionRangeMatcher.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/version/VersionRangeMatcher.java?rev=673934&r1=673933&r2=673934&view=diff
==============================================================================
--- 
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/version/VersionRangeMatcher.java
 (original)
+++ 
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/version/VersionRangeMatcher.java
 Fri Jul  4 00:25:37 2008
@@ -42,10 +42,12 @@
     private static final String OPEN_INC = "[";
 
     private static final String OPEN_EXC = "]";
+    private static final String OPEN_EXC_MAVEN = "(";
 
     private static final String CLOSE_INC = "]";
 
     private static final String CLOSE_EXC = "[";
+    private static final String CLOSE_EXC_MAVEN = ")";
 
     private static final String LOWER_INFINITE = "(";
 
@@ -56,11 +58,13 @@
     // following patterns are built upon constants above and should not be 
modified
     private static final String OPEN_INC_PATTERN = "\\" + OPEN_INC;
 
-    private static final String OPEN_EXC_PATTERN = "\\" + OPEN_EXC;
+    private static final String OPEN_EXC_PATTERN = "[" + "\\" + OPEN_EXC 
+                                                        + "\\" + 
OPEN_EXC_MAVEN + "]";
 
     private static final String CLOSE_INC_PATTERN = "\\" + CLOSE_INC;
 
-    private static final String CLOSE_EXC_PATTERN = "\\" + CLOSE_EXC;
+    private static final String CLOSE_EXC_PATTERN = "[" + "\\" + CLOSE_EXC 
+                                                        + "\\" + 
CLOSE_EXC_MAVEN + "]";
 
     private static final String LI_PATTERN = "\\" + LOWER_INFINITE;
 

Modified: 
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/version/VersionRangeMatcherTest.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/version/VersionRangeMatcherTest.java?rev=673934&r1=673933&r2=673934&view=diff
==============================================================================
--- 
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/version/VersionRangeMatcherTest.java
 (original)
+++ 
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/version/VersionRangeMatcherTest.java
 Fri Jul  4 00:25:37 2008
@@ -27,12 +27,31 @@
 
     public VersionRangeMatcherTest() {
     }
+    
+    public void testMavenExcludeParenthesis() throws Exception {
+        assertAccept("[3.8,4.0)", "3.7", false);
+        assertAccept("[3.8,4.0)", "3.8", true);
+        assertAccept("[3.8,4.0)", "3.9", true);
+        assertAccept("[3.8,4.0)", "4.0", false);
+        assertAccept("[3.8,4.0)", "4.1", false);
+        
+        assertAccept("(3.8,4.0]", "3.7", false);
+        assertAccept("(3.8,4.0]", "3.8", false);
+        assertAccept("(3.8,4.0]", "3.9", true);
+        assertAccept("(3.8,4.0]", "4.0", true);
+        assertAccept("(3.8,4.0]", "4.1", false);
+        
+        assertAccept("(3.8,4.0)", "3.7", false);
+        assertAccept("(3.8,4.0)", "3.8", false);
+        assertAccept("(3.8,4.0)", "3.9", true);
+        assertAccept("(3.8,4.0)", "4.0", false);
+        assertAccept("(3.8,4.0)", "4.1", false);
+    }
 
     public void testDynamic() {
         assertDynamic("lastest.integration", false);
         assertDynamic("[1.0]", false);
         assertDynamic("(1.0)", false);
-        assertDynamic("(1.0,2.0)", false);
         assertDynamic("[1.0;2.0]", false);
 
         assertDynamic("[1.0,2.0]", true);
@@ -42,6 +61,9 @@
         assertDynamic("[1.0,)", true);
         assertDynamic("(,1.0]", true);
 
+        assertDynamic("(1.0, 2.0)", true);
+        assertDynamic("(1.0, 2.0]", true);
+        assertDynamic("[1.0, 2.0)", true);
         assertDynamic("[1.0, 2.0]", true);
         assertDynamic("[ 1.0, 2.0]", true);
         assertDynamic("[1.0, 2.0 ]", true);


Reply via email to