Skip to content

Commit

Permalink
Fix javadoc, reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
cstamas committed Dec 12, 2024
1 parent 9bbf196 commit ee483dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.apache.maven.api.annotations.Experimental;

/**
* Base class for all maven exceptions.
* Base class for all maven exceptions carrying {@link BuilderProblem}s.
*
* @since 4.0.0
*/
Expand All @@ -44,12 +44,17 @@ public MavenBuilderException(String message, List<BuilderProblem> problems) {
this.problems = problems;
}

/**
* Formats message out of problems: problems are sorted (in natural order of {@link BuilderProblem.Severity})
* and then a list is built. These exceptions are usually thrown in "fatal" cases (and usually prevent Maven
* from starting), and these exceptions may end up very early on output.
*/
protected static String buildMessage(String message, List<BuilderProblem> problems) {
StringBuilder msg = new StringBuilder(message);
ArrayList<BuilderProblem> sorted = new ArrayList<>(problems);
sorted.sort(Comparator.comparing(BuilderProblem::getSeverity));
for (BuilderProblem problem : sorted) {
msg.append("\n * ").append(problem.getSeverity().name()).append(" ").append(problem.getMessage());
msg.append("\n * ").append(problem.getSeverity().name()).append(": ").append(problem.getMessage());
}
return msg.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ void testLegacy() throws Exception {
verifier.verifyErrorFreeLog();

// there is a warning and all fields decrypted
verifier.verifyTextInLog("[INFO] Some problems were encountered while building the effective settings (use -X to see details)");
verifier.verifyTextInLog(
"[INFO] Some problems were encountered while building the effective settings (use -X to see details)");
verifier.verifyTextInLog("<password>testtest</password>");
verifier.verifyTextInLog("<value>testtest</value>");
}
Expand All @@ -70,7 +71,8 @@ void testModern() throws Exception {

// there is no warning and all fields decrypted
verifier.verifyTextNotInLog("[WARNING]");
verifier.verifyTextNotInLog("[INFO] Some problems were encountered while building the effective settings (use -X to see details)");
verifier.verifyTextNotInLog(
"[INFO] Some problems were encountered while building the effective settings (use -X to see details)");
verifier.verifyTextInLog("<password>testtest</password>");
verifier.verifyTextInLog("<value>secretHeader</value>");
}
Expand Down

0 comments on commit ee483dc

Please sign in to comment.