You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2023/05/15 11:15:49 UTC
[maven-pdf-plugin] branch master updated: [MNG-6829] Replace StringUtils#isEmpty(String) and #isNotEmpty(String) (#41)
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-pdf-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 8666b4a [MNG-6829] Replace StringUtils#isEmpty(String) and #isNotEmpty(String) (#41)
8666b4a is described below
commit 8666b4a189e19cbe0c46291abe8f103acc425076
Author: Tim te Beek <ti...@gmail.com>
AuthorDate: Mon May 15 13:15:43 2023 +0200
[MNG-6829] Replace StringUtils#isEmpty(String) and #isNotEmpty(String) (#41)
Use this link to re-run the recipe: https://public.moderne.io/recipes/org.openrewrite.java.migrate.apache.commons.lang.IsNotEmptyToJdk?organizationId=QXBhY2hlIE1hdmVu
Co-authored-by: Moderne <te...@moderne.io>
---
src/main/java/org/apache/maven/plugins/pdf/DocumentModelBuilder.java | 4 ++--
src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java | 2 +-
src/test/java/org/apache/maven/plugins/pdf/PdfMojoTest.java | 3 +--
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/pdf/DocumentModelBuilder.java b/src/main/java/org/apache/maven/plugins/pdf/DocumentModelBuilder.java
index d787e21..304ec23 100644
--- a/src/main/java/org/apache/maven/plugins/pdf/DocumentModelBuilder.java
+++ b/src/main/java/org/apache/maven/plugins/pdf/DocumentModelBuilder.java
@@ -98,7 +98,7 @@ public class DocumentModelBuilder {
* @return a DocumentModel. Always non-null.
*/
private static DocumentModel getDocumentModel(MavenProject project, DecorationModel decorationModel, Date date) {
- final Date now = (date == null ? new Date() : date);
+ final Date now = date == null ? new Date() : date;
final DocumentModel docModel = new DocumentModel();
@@ -278,7 +278,7 @@ public class DocumentModelBuilder {
// nop
}
- if (StringUtils.isEmpty(encoding)) {
+ if (encoding == null || encoding.isEmpty()) {
return "UTF-8";
}
diff --git a/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java b/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
index ba966d8..ac099f4 100644
--- a/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
+++ b/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
@@ -1197,7 +1197,7 @@ public class PdfMojo extends AbstractPdfMojo implements Contextualizable {
* @since 1.1
*/
private static void writeGeneratedReport(String content, File toFile) throws IOException {
- if (StringUtils.isEmpty(content)) {
+ if (content == null || content.isEmpty()) {
return;
}
diff --git a/src/test/java/org/apache/maven/plugins/pdf/PdfMojoTest.java b/src/test/java/org/apache/maven/plugins/pdf/PdfMojoTest.java
index bd84848..42ed4ab 100644
--- a/src/test/java/org/apache/maven/plugins/pdf/PdfMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/pdf/PdfMojoTest.java
@@ -43,7 +43,6 @@ import java.io.Reader;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;
-import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.cli.CommandLineUtils;
/**
@@ -95,7 +94,7 @@ public class PdfMojoTest extends AbstractMojoTestCase {
assertTrue(foContent.indexOf("1.0-SNAPSHOT") > 0);
// env ${M2_HOME}
String m2Home = CommandLineUtils.getSystemEnvVars().getProperty("M2_HOME");
- if (StringUtils.isNotEmpty(m2Home)) {
+ if (m2Home != null && !m2Home.isEmpty()) {
assertTrue(foContent.indexOf(m2Home) > 0);
}
// ${project.developers[0].email}