Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNG-6829] Replace any StringUtils#isEmpty(String) and #isNotEmpty(String) #124

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ protected String constructXRefLocation(boolean test) {

String relativePath =
PathTool.getRelativePath(outputDirectory.getAbsolutePath(), xrefLoc.getAbsolutePath());
if (StringUtils.isEmpty(relativePath)) {
if (relativePath == null || relativePath.isEmpty()) {
relativePath = ".";
}
relativePath = relativePath + "/" + xrefLoc.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

import net.sourceforge.pmd.cpd.Mark;
import net.sourceforge.pmd.cpd.Match;
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.pmd.model.CpdFile;
import org.apache.maven.plugins.pmd.model.Duplication;
Expand Down Expand Up @@ -99,7 +98,7 @@ private boolean fileExcludedByGroup(final String path, final Set<String> singleE

@Override
public void loadExcludeFromFailuresData(final String excludeFromFailureFile) throws MojoExecutionException {
if (StringUtils.isEmpty(excludeFromFailureFile)) {
if (excludeFromFailureFile == null || excludeFromFailureFile.isEmpty()) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.util.Set;

import net.sourceforge.pmd.RuleViolation;
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.pmd.model.Violation;

Expand All @@ -45,7 +44,7 @@ public class ExcludeViolationsFromFile implements ExcludeFromFile<Violation> {

@Override
public void loadExcludeFromFailuresData(final String excludeFromFailureFile) throws MojoExecutionException {
if (StringUtils.isEmpty(excludeFromFailureFile)) {
if (excludeFromFailureFile == null || excludeFromFailureFile.isEmpty()) {
return;
}

Expand Down Expand Up @@ -107,9 +106,9 @@ private boolean isExcludedFromFailure(String className, String ruleName) {
private String extractClassName(String packageName, String className, String fullPath) {
// for some reason, some violations don't contain the package name, so we have to guess the full class name
// this looks like a bug in PMD - at least for UnusedImport rule.
if (StringUtils.isNotEmpty(packageName) && StringUtils.isNotEmpty(className)) {
if ((packageName != null && !packageName.isEmpty()) && (className != null && !className.isEmpty())) {
timtebeek marked this conversation as resolved.
Show resolved Hide resolved
return packageName + "." + className;
} else if (StringUtils.isNotEmpty(packageName)) {
} else if (packageName != null && !packageName.isEmpty()) {
String fileName = fullPath;
fileName = fileName.substring(fileName.lastIndexOf(File.separatorChar) + 1);
fileName = fileName.substring(0, fileName.length() - 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.apache.maven.plugins.pmd.model.PmdFile;
import org.apache.maven.plugins.pmd.model.Violation;
import org.apache.maven.plugins.pmd.model.io.xpp3.PmdXpp3Reader;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;

/**
Expand Down Expand Up @@ -143,7 +142,7 @@ protected ViolationDetails<Violation> newViolationDetailsInstance() {
private String getFilename(String fullpath, String pkg) {
int index = fullpath.lastIndexOf(File.separatorChar);

while (StringUtils.isNotEmpty(pkg)) {
while ((pkg != null && !pkg.isEmpty())) {
timtebeek marked this conversation as resolved.
Show resolved Hide resolved
index = fullpath.substring(0, index).lastIndexOf(File.separatorChar);

int dot = pkg.indexOf('.');
Expand Down