Fixing #251: proper handling of InvalidSegmentException and InvalidVersionSpecificationException #666
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The situations indicated in the exceptions were not handled properly throughout the code, in some places,
MojoExcecutionException
was simply being thrown leading to the whole run being stopped;InvalidVersionSpecificationException
was unchecked, leading to the same.Handling those situations in the Mojo itself rather than in the methods so that a proper handling could be effected where necessary.
Because of all that, a rather sizeable refactoring was due.
More PRs will follow, I want to refactor and polish the code more, but this one is what's necessary for resolving this issue.
So, like I said in the linked issue:
The more I look into it, the more issues I see:
AbstractVersionsUpaterMojo.determineUnchangedSegment
orMavenVersionComparator.innerIncrementSegment
), but the comparison against the segment count suffers from the 1-off problem:There are probably more problems with this, but I'll limit the scope of this item to the issue OP raised only. The other findings will be done as separate issues.