Skip to content

Commit

Permalink
Replace deprecated toString methods (apache#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo authored Dec 7, 2024
1 parent e3e93fe commit 764c2cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/main/java/org/apache/maven/plugins/help/DescribeMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ public class DescribeMojo extends AbstractHelpMojo {
/**
* {@inheritDoc}
*/
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
StringBuilder descriptionBuffer = new StringBuilder();

Expand Down Expand Up @@ -397,15 +398,15 @@ private void describePlugin(PluginDescriptor pd, StringBuilder buffer)
name = pd.getId();
}
}
append(buffer, "Name", MessageUtils.buffer().strong(name).toString(), 0);
append(buffer, "Name", MessageUtils.buffer().strong(name).build(), 0);
appendAsParagraph(buffer, "Description", toDescription(pd.getDescription()), 0);
append(buffer, "Group Id", pd.getGroupId(), 0);
append(buffer, "Artifact Id", pd.getArtifactId(), 0);
append(buffer, "Version", pd.getVersion(), 0);
append(
buffer,
"Goal Prefix",
MessageUtils.buffer().strong(pd.getGoalPrefix()).toString(),
MessageUtils.buffer().strong(pd.getGoalPrefix()).build(),
0);
buffer.append(LS);

Expand Down Expand Up @@ -469,7 +470,7 @@ private void describeMojo(MojoDescriptor md, StringBuilder buffer)
*/
private void describeMojoGuts(MojoDescriptor md, StringBuilder buffer, boolean fullDescription)
throws MojoFailureException, MojoExecutionException {
append(buffer, MessageUtils.buffer().strong(md.getFullGoalName()).toString(), 0);
append(buffer, MessageUtils.buffer().strong(md.getFullGoalName()).build(), 0);

// indent 1
appendAsParagraph(buffer, "Description", toDescription(md.getDescription()), 1);
Expand All @@ -482,7 +483,7 @@ private void describeMojoGuts(MojoDescriptor md, StringBuilder buffer, boolean f
if (deprecation != null && !deprecation.isEmpty()) {
append(
buffer,
MessageUtils.buffer().warning("Deprecated. " + deprecation).toString(),
MessageUtils.buffer().warning("Deprecated. " + deprecation).build(),
1);
}

Expand Down Expand Up @@ -612,7 +613,7 @@ private void describeMojoParameters(MojoDescriptor md, StringBuilder buffer)
buffer,
MessageUtils.buffer()
.warning("Deprecated. " + deprecation)
.toString(),
.build(),
3);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public class EffectivePomMojo extends AbstractEffectiveMojo {
// ----------------------------------------------------------------------

/** {@inheritDoc} */
@Override
public void execute() throws MojoExecutionException {
if (artifact != null && !artifact.isEmpty()) {
project = getMavenProject(artifact);
Expand Down Expand Up @@ -131,7 +132,7 @@ public void execute() throws MojoExecutionException {
} else {
if (MessageUtils.isColorEnabled()) {
// add color to comments
String comment = MessageUtils.buffer().project("<!--.-->").toString();
String comment = MessageUtils.buffer().project("<!--.-->").build();
int dotIndex = comment.indexOf(".");
String commentStart = comment.substring(0, dotIndex);
String commentEnd = comment.substring(dotIndex + 1);
Expand Down

0 comments on commit 764c2cf

Please sign in to comment.