You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ace.apache.org by ma...@apache.org on 2011/01/05 20:51:12 UTC

svn commit: r1055607 - in /incubator/ace/trunk/ace-obr-metadata/src: main/java/org/osgi/impl/bundle/obr/resource/VersionRange.java test/java/org/apache/ace/obr/metadata/bindeximpl/VersionRangeTest.java

Author: marrs
Date: Wed Jan  5 19:51:11 2011
New Revision: 1055607

URL: http://svn.apache.org/viewvc?rev=1055607&view=rev
Log:
ACE-95 Bug fixed, error in comparison. Added a test for it.

Added:
    incubator/ace/trunk/ace-obr-metadata/src/test/java/org/apache/ace/obr/metadata/bindeximpl/VersionRangeTest.java
Modified:
    incubator/ace/trunk/ace-obr-metadata/src/main/java/org/osgi/impl/bundle/obr/resource/VersionRange.java

Modified: incubator/ace/trunk/ace-obr-metadata/src/main/java/org/osgi/impl/bundle/obr/resource/VersionRange.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-obr-metadata/src/main/java/org/osgi/impl/bundle/obr/resource/VersionRange.java?rev=1055607&r1=1055606&r2=1055607&view=diff
==============================================================================
--- incubator/ace/trunk/ace-obr-metadata/src/main/java/org/osgi/impl/bundle/obr/resource/VersionRange.java (original)
+++ incubator/ace/trunk/ace-obr-metadata/src/main/java/org/osgi/impl/bundle/obr/resource/VersionRange.java Wed Jan  5 19:51:11 2011
@@ -40,13 +40,13 @@ public class VersionRange implements Com
 			low = new Version(m.group(2));
 			high = new Version(m.group(6));
 			end = m.group(10).charAt(0);
-			if (low.compareTo(high) >= 0)
+			if (low.compareTo(high) > 0)
 				throw new IllegalArgumentException(
 						"Low Range is higher than High Range: " + low + "-"
 								+ high);
 
 		} else
-			high = low = new Version(string);
+			high = low = new Version(string); // TODO marrs: really?
 	}
 
 	public boolean isRange() {

Added: incubator/ace/trunk/ace-obr-metadata/src/test/java/org/apache/ace/obr/metadata/bindeximpl/VersionRangeTest.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-obr-metadata/src/test/java/org/apache/ace/obr/metadata/bindeximpl/VersionRangeTest.java?rev=1055607&view=auto
==============================================================================
--- incubator/ace/trunk/ace-obr-metadata/src/test/java/org/apache/ace/obr/metadata/bindeximpl/VersionRangeTest.java (added)
+++ incubator/ace/trunk/ace-obr-metadata/src/test/java/org/apache/ace/obr/metadata/bindeximpl/VersionRangeTest.java Wed Jan  5 19:51:11 2011
@@ -0,0 +1,32 @@
+/*
+ * 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.ace.obr.metadata.bindeximpl;
+
+import static org.apache.ace.test.utils.TestUtils.UNIT;
+import org.osgi.impl.bundle.obr.resource.VersionRange;
+import org.testng.annotations.Test;
+
+public class VersionRangeTest {
+	@Test(groups = { UNIT })
+    public void testACE95() throws Exception {
+		new VersionRange("[4.1,4.2)");
+		new VersionRange("[4.2,4.2]");
+	}
+}
\ No newline at end of file