Use StringUtils.equalsIgnoreCase

This commit is contained in:
Andreas Dangel
2020-07-03 11:58:38 +02:00
parent 147f1ac053
commit 1fb085f7ab

View File

@ -7,6 +7,8 @@ package net.sourceforge.pmd.lang.apex.rule.bestpractices;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import net.sourceforge.pmd.lang.apex.ast.ASTBlockStatement;
import net.sourceforge.pmd.lang.apex.ast.ASTReferenceExpression;
import net.sourceforge.pmd.lang.apex.ast.ASTVariableDeclaration;
@ -41,7 +43,7 @@ public class UnusedLocalVariableRule extends AbstractApexRule {
continue;
}
if (equalsIgnoreCase(variableName, usage.getImage())) {
if (StringUtils.equalsIgnoreCase(variableName, usage.getImage())) {
return data;
}
}
@ -49,14 +51,4 @@ public class UnusedLocalVariableRule extends AbstractApexRule {
addViolation(data, node, variableName);
return data;
}
private static boolean equalsIgnoreCase(String a, String b) {
if (a == b) {
return true;
}
if (a == null || b == null) {
return false;
}
return a.equalsIgnoreCase(b);
}
}