fasten-project / fasten

Analyse package dependency networks at the call graph level
https://www.fasten-project.eu
Apache License 2.0
86 stars 28 forks source link

Trim trailing and leading whitespace when getting upper/lower bound versions #489

Closed mir-am closed 1 year ago

mir-am commented 1 year ago

Description

This is a small fix to the getUpperBound and getLowerBound methods in VersionConstraint to trim trailing and leading whitespace.

Motivation and context

Whitespace in version strings might cause issues, for example, when downloading Jars or doing comparisons.

Testing

Added a unit test.

proksch commented 1 year ago

The problem with this class is that it is central for the (de-) centralization of Pom objects... I would prefer not to change it without deeper analysis of the effect of the changes on performance.

I also do not see the use case, how would you create a download URL for a version range? There is no way you can figure out all versions in between, for that, you need the resolution service, which does return a ResolvedRevision instead...

proksch commented 1 year ago

If white spaces remain indeed an issue, this should be addressed in the extractor that "fills" the VersionConstraint.... we could simply remove all spaces (or any whitespace for that matter), they do not carry any meaning in a version.

mir-am commented 1 year ago

I agree with the points above. Also, I am using RestMavenResolver in core to get dependencies with a resolved version. So, there seems to be no need to merge this PR. I am going to close this PR.