[
https://issues.apache.org/jira/browse/MNG-7106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17290931#comment-17290931
]
Brandon Heck commented on MNG-7106:
-----------------------------------
Would the preference be to fix this in parseRestriction by skipping the
creation of a Restriction for a hard version requirement? Would it be
preferable to fix this in the {{toString}} by checking the bounds for equality
when constructing the string? Is there another way this might be fixed that
would be better than either of those suggestions? I'm assuming that the first
suggestion may have unintended consequences when building the effective model.
> VersionRange produces a version range that is incompatible with itself
> ----------------------------------------------------------------------
>
> Key: MNG-7106
> URL: https://issues.apache.org/jira/browse/MNG-7106
> Project: Maven
> Issue Type: Bug
> Affects Versions: 3.6.3
> Reporter: Akshay Shankara
> Priority: Minor
>
> When a hard version requirement (Ex - [1.0]) is passed to
> [VersionRange#createFromVersionSpec(String)|https://github.com/apache/maven/blob/maven-3.6.3/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/VersionRange.java#L106],
> it is parsed to [1.0, 1.0]. But, this version range is invalid [according to
> this
> exception|https://github.com/apache/maven/blob/maven-3.6.3/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/VersionRange.java#L214-L217].
> If the parsed version range ([1.0, 1.0]) is converted to a String, it cannot
> be parsed once again by VersionRange#createFromVersionSpec(String).
> Steps to reproduce -
> {code:java}
> VersionRange versionRange = VersionRange.createFromVersionSpec("[1.0]"); //
> [1.0, 1.0]
> String stringVersionRange = VersionRange.toString(versionRange); // "[1.0,
> 1.0]"
> VersionRange exceptionVersionRange =
> VersionRange.createFromVersionSpec(stringVersionRange); // <-
> InvalidVersionSpecificationException( "Range cannot have identical
> boundaries: [1.0, 1.0]" )
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)