incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From timothyjw...@apache.org
Subject svn commit: r1027605 - /incubator/aries/trunk/util/src/main/java/org/apache/aries/util/VersionRange.java
Date Tue, 26 Oct 2010 15:57:04 GMT
Author: timothyjward
Date: Tue Oct 26 15:57:04 2010
New Revision: 1027605

URL: http://svn.apache.org/viewvc?rev=1027605&view=rev
Log:
ARIES-464 : Pass an ApplicationMetadata to the PostResolveTransformer - fix VersionRange problem

Modified:
    incubator/aries/trunk/util/src/main/java/org/apache/aries/util/VersionRange.java

Modified: incubator/aries/trunk/util/src/main/java/org/apache/aries/util/VersionRange.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/util/src/main/java/org/apache/aries/util/VersionRange.java?rev=1027605&r1=1027604&r2=1027605&view=diff
==============================================================================
--- incubator/aries/trunk/util/src/main/java/org/apache/aries/util/VersionRange.java (original)
+++ incubator/aries/trunk/util/src/main/java/org/apache/aries/util/VersionRange.java Tue Oct
26 15:57:04 2010
@@ -51,24 +51,30 @@ public final class VersionRange {
      */
     public VersionRange(String version) {
         this.version = version;
-        processVersionAttribute(this.version);
+        processVersionAttribute(version);
     }
 
     /**
-     * 
+     * This method should be used to create a version range from a single
+     * version string.
      * @param version
      *            version for the versioninfo
      * @param exactVersion
-     *            whether this is an exact version
+     *            whether this is an exact version {@code true} or goes to infinity
+     *            {@code false}
      */
     public VersionRange(String version, boolean exactVersion) {
-        this.version = version;
+        
         if (exactVersion) {
+            // Store the correct version string 
+            this.version = "[" + version + "," + version + "]";
+            // Use the modified version string to parse
             processExactVersionAttribute(this.version);
         } else {
+            this.version = version;
             processVersionAttribute(this.version);
         }
-
+        
         assertInvariants();
     }
 
@@ -101,7 +107,8 @@ public final class VersionRange {
      */
     @Override
     public String toString() {
-        // Some constructors don't take in a string, so construct one if needed
+        // Some constructors don't take in a string that we can return directly, 
+        // so construct one if needed
         if (version == null) {
             if (maximumVersion == null) {
                 version = minimumVersion.toString();
@@ -208,10 +215,6 @@ public final class VersionRange {
     private boolean processExactVersionAttribute(String version) throws IllegalArgumentException
{
         boolean success = processVersionAttribute(version);
 
-        if (maximumVersion == null) {
-            maximumVersion = minimumVersion;
-        }
-
         if (!minimumVersion.equals(maximumVersion)) {
             throw new IllegalArgumentException(MessageUtil.getMessage("UTIL0011E", version));
         }



Mime
View raw message