Skip to content

Commit 6f13412

Browse files
authored
Prefer JDK replace method over deprecated StringUtils method (#1230)
* Prefer JDK replace method over deprecated StringUtils method * check for null
1 parent 9252698 commit 6f13412

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2664,12 +2664,15 @@ private void populateCompileArtifactMap(Map<String, Artifact> compileArtifactMap
26642664
}
26652665

26662666
/**
2667-
* Method that sets the bottom text that will be displayed on the bottom of the
2668-
* javadocs.
2667+
* Method that sets the text that will be displayed on the bottom of the javadocs.
26692668
*
26702669
* @return a String that contains the text that will be displayed at the bottom of the javadoc
26712670
*/
26722671
private String getBottomText() {
2672+
if (this.bottom == null) {
2673+
return null;
2674+
}
2675+
26732676
final String inceptionYear = project.getInceptionYear();
26742677

26752678
// get Reproducible Builds outputTimestamp date value or the current local date.
@@ -2679,32 +2682,29 @@ private String getBottomText() {
26792682

26802683
final String currentYear = Integer.toString(localDate.getYear());
26812684

2682-
String theBottom = StringUtils.replace(this.bottom, "{currentYear}", currentYear);
2685+
String theBottom = this.bottom.replace("{currentYear}", currentYear);
26832686

26842687
if ((inceptionYear == null) || inceptionYear.equals(currentYear)) {
2685-
theBottom = StringUtils.replace(theBottom, "{inceptionYear}&#x2013;", "");
2688+
theBottom = theBottom.replace("{inceptionYear}&#x2013;", "");
26862689
} else {
2687-
theBottom = StringUtils.replace(theBottom, "{inceptionYear}", inceptionYear);
2690+
theBottom = theBottom.replace("{inceptionYear}", inceptionYear);
26882691
}
26892692

26902693
if (project.getOrganization() == null) {
2691-
theBottom = StringUtils.replace(theBottom, " {organizationName}", "");
2694+
theBottom = theBottom.replace(" {organizationName}", "");
26922695
} else {
26932696
if (StringUtils.isNotEmpty(project.getOrganization().getName())) {
26942697
if (StringUtils.isNotEmpty(project.getOrganization().getUrl())) {
2695-
theBottom = StringUtils.replace(
2696-
theBottom,
2698+
theBottom = theBottom.replace(
26972699
"{organizationName}",
26982700
"<a href=\"" + project.getOrganization().getUrl() + "\">"
26992701
+ project.getOrganization().getName() + "</a>");
27002702
} else {
2701-
theBottom = StringUtils.replace(
2702-
theBottom,
2703-
"{organizationName}",
2704-
project.getOrganization().getName());
2703+
theBottom = theBottom.replace(
2704+
"{organizationName}", project.getOrganization().getName());
27052705
}
27062706
} else {
2707-
theBottom = StringUtils.replace(theBottom, " {organizationName}", "");
2707+
theBottom = theBottom.replace(" {organizationName}", "");
27082708
}
27092709
}
27102710

@@ -4810,7 +4810,7 @@ private void addGroups(List<String> arguments) throws MavenReportException {
48104810
getLog().warn("A group option is empty. Ignore this option.");
48114811
}
48124812
} else {
4813-
String groupTitle = StringUtils.replace(group.getTitle(), ",", "&#44;");
4813+
String groupTitle = group.getTitle().replace(",", "&#44;");
48144814
addArgIfNotEmpty(
48154815
arguments,
48164816
"-group",

0 commit comments

Comments
 (0)