replaced getImage().equals with utility method hasImageEqualTo (cleaner & handles nulls)

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4694 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Brian Remedios
2006-10-17 01:07:18 +00:00
parent 3969dcbf7c
commit e54bf36d7a

View File

@ -38,7 +38,7 @@ public abstract class AbstractSunSecureRule extends AbstractRule {
for (Iterator it = fds.iterator(); it.hasNext();) {
final ASTFieldDeclaration fd = (ASTFieldDeclaration) it.next();
final ASTVariableDeclaratorId vid = (ASTVariableDeclaratorId) fd.getFirstChildOfType(ASTVariableDeclaratorId.class);
if (vid != null && vid.getImage().equals(varName)) {
if (vid != null && vid.hasImageEqualTo(varName)) {
return true;
}
}
@ -81,7 +81,7 @@ public abstract class AbstractSunSecureRule extends AbstractRule {
for (Iterator it = lvars.iterator(); it.hasNext();) {
final ASTLocalVariableDeclaration lvd = (ASTLocalVariableDeclaration) it.next();
final ASTVariableDeclaratorId vid = (ASTVariableDeclaratorId) lvd.getFirstChildOfType(ASTVariableDeclaratorId.class);
if (vid != null && vid.getImage().equals(vn)) {
if (vid != null && vid.hasImageEqualTo(vn)) {
return true;
}
}