Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9ebda63

Browse filesBrowse files
[MNG-6829] Replace StringUtils#isEmpty(String) and #isNotEmpty(String) (#121)
Continuation of https://issues.apache.org/jira/browse/MNG-6829 Review requested of @elharo 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 <team@moderne.io>
1 parent 472ed5a commit 9ebda63
Copy full SHA for 9ebda63

File tree

3 files changed

+6
-8
lines changed
Filter options

3 files changed

+6
-8
lines changed

‎src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java

Copy file name to clipboardExpand all lines: src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import com.puppycrawl.tools.checkstyle.api.AuditListener;
3535
import com.puppycrawl.tools.checkstyle.api.AutomaticBean.OutputStreamOptions;
3636
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
37-
import org.apache.commons.lang3.StringUtils;
3837
import org.apache.maven.artifact.Artifact;
3938
import org.apache.maven.execution.MavenSession;
4039
import org.apache.maven.model.Dependency;
@@ -602,7 +601,7 @@ private List<Artifact> getCheckstylePluginDependenciesAsArtifacts(Map<String, Pl
602601
protected AuditListener getListener() throws MavenReportException {
603602
AuditListener listener = null;
604603

605-
if (StringUtils.isNotEmpty(outputFileFormat)) {
604+
if (outputFileFormat != null && !outputFileFormat.isEmpty()) {
606605
File resultFile = outputFile;
607606

608607
OutputStream out = getOutputStream(resultFile);

‎src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java

Copy file name to clipboardExpand all lines: src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import com.puppycrawl.tools.checkstyle.api.AuditListener;
3838
import com.puppycrawl.tools.checkstyle.api.AutomaticBean.OutputStreamOptions;
3939
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
40-
import org.apache.commons.lang3.StringUtils;
4140
import org.apache.maven.artifact.Artifact;
4241
import org.apache.maven.model.Dependency;
4342
import org.apache.maven.model.Plugin;
@@ -772,7 +771,7 @@ private OutputStream getOutputStream(File file) throws MojoExecutionException {
772771
private AuditListener getListener() throws MojoFailureException, MojoExecutionException {
773772
AuditListener listener = null;
774773

775-
if (StringUtils.isNotEmpty(outputFileFormat)) {
774+
if (outputFileFormat != null && !outputFileFormat.isEmpty()) {
776775
File resultFile = outputFile;
777776

778777
OutputStream out = getOutputStream(resultFile);

‎src/main/java/org/apache/maven/plugins/checkstyle/exec/DefaultCheckstyleExecutor.java

Copy file name to clipboardExpand all lines: src/main/java/org/apache/maven/plugins/checkstyle/exec/DefaultCheckstyleExecutor.java
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ private Properties getOverridingProperties(CheckstyleExecutorRequest request) th
402402
getLogger().debug("headerLocation " + headerLocation);
403403
}
404404

405-
if (StringUtils.isNotEmpty(headerLocation)) {
405+
if (headerLocation != null && !headerLocation.isEmpty()) {
406406
try {
407407
File headerFile = licenseLocator.getResourceAsFile(headerLocation, "checkstyle-header.txt");
408408

@@ -551,15 +551,15 @@ private void addResourceFilesToProcess(
551551
if (resourcesDirectory.equals(request.getProject().getBasedir())) {
552552
String resourceIncludes =
553553
StringUtils.join(resource.getIncludes().iterator(), ",");
554-
if (StringUtils.isEmpty(includes)) {
554+
if (includes == null || includes.isEmpty()) {
555555
includes = resourceIncludes;
556556
} else {
557557
includes += "," + resourceIncludes;
558558
}
559559

560560
String resourceExcludes =
561561
StringUtils.join(resource.getExcludes().iterator(), ",");
562-
if (StringUtils.isEmpty(excludes)) {
562+
if (excludes == null || excludes.isEmpty()) {
563563
excludes = resourceExcludes;
564564
} else {
565565
excludes += "," + resourceExcludes;
@@ -594,7 +594,7 @@ private FilterSet getSuppressionsFilterSet(final String suppressionsFilePath) th
594594

595595
private String getSuppressionsFilePath(final CheckstyleExecutorRequest request) throws CheckstyleExecutorException {
596596
final String suppressionsLocation = request.getSuppressionsLocation();
597-
if (StringUtils.isEmpty(suppressionsLocation)) {
597+
if (suppressionsLocation == null || suppressionsLocation.isEmpty()) {
598598
return null;
599599
}
600600

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.