You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/10/13 11:20:27 UTC

[GitHub] [maven] kwin commented on a diff in pull request #825: [MNG-7106] Accept same lower and upper bound in version spec string

kwin commented on code in PR #825:
URL: https://github.com/apache/maven/pull/825#discussion_r994514644


##########
maven-artifact/src/main/java/org/apache/maven/artifact/versioning/VersionRange.java:
##########
@@ -227,9 +223,13 @@ private static Restriction parseRestriction( String spec )
                 upperVersion = new DefaultArtifactVersion( upperBound );
             }
 
-            if ( upperVersion != null && lowerVersion != null && upperVersion.compareTo( lowerVersion ) < 0 )
+            if ( upperVersion != null && lowerVersion != null )
             {
-                throw new InvalidVersionSpecificationException( "Range defies version ordering: " + spec );
+                int result = upperVersion.compareTo( lowerVersion );
+                if ( result < 0 || ( result == 0 && ( !lowerBoundInclusive || !upperBoundInclusive ) ) )
+                {
+                    throw new InvalidVersionSpecificationException( "Range defies version ordering: " + spec );
+                }

Review Comment:
   There was and still is a test covering this: https://github.com/apache/maven/blob/c8518e811f53c4fe89a85616aa3ff94e37a91e77/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/VersionRangeTest.java#L177-L178



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org