-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Fix #10950: Replace raw RuntimeException on reactor cycle with ProjectBuildingExc… #11091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
final ProjectCycleException pce = new ProjectCycleException( | ||
"The projects in the reactor contain a cyclic reference: " + cycle.getMessage(), cde); | ||
|
||
// If you can resolve these from the problem/result, set them; otherwise leave null. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment doesn't seem right. They can't be set here.
"The projects in the reactor contain a cyclic reference: " + cycle.getMessage(), | ||
(CycleDetectedException) cycle.getException())); | ||
pomFile, | ||
pce); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not clear why pce was created. Could you just pass the cde here?
…; keep CycleDetectedException as cause. Non-cycle model problems still use ProjectBuildingException(results). Remove misleading comment about projectId/pomFile.
please do another pass |
@@ -492,10 +491,14 @@ List<ProjectBuildingResult> build(List<File> pomFiles, boolean recursive) throws | |||
.findAny() | |||
.orElse(null); | |||
if (cycle != null) { | |||
throw new RuntimeException(new ProjectCycleException( | |||
final CycleDetectedException cde = (CycleDetectedException) cycle.getException(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wrapping still smells like something's not quite right. The code is quite complex, and it might be simpler without the lambda, but either way we really should be able to just throw the CycleDetectedException. This is not a public method so we can easily add that to the method signature. It's also possible CycleDetectedException should be a subclass of ProjectBuildingException.
…eption.
When a reactor dependency cycle is detected, wrap the underlying org.codehaus.plexus.util.dag.CycleDetectedException in a new ProjectCycleException and throw a checked ProjectBuildingException (as declared by ProjectBuilder) instead of a raw RuntimeException.
Keep non-cycle model problems on the existing ProjectBuildingException(results) path.
Following this checklist to help us incorporate your
contribution quickly and easily:
Note that commits might be squashed by a maintainer on merge.
This may not always be possible but is a best-practice.
mvn verify
to make sure basic checks pass.A more thorough check will be performed on your pull request automatically.
If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.