修改:修改标识符添加方式

wuhaoyang
RenFengJiang 10 months ago
parent b007bb9f3b
commit 1390585ba5
  1. 13
      sonar-keyware-plugins-java/src/main/java/com/keyware/sonar/java/rules/checkers/InputSQLVerifyChecker.java

@ -53,15 +53,12 @@ public class InputSQLVerifyChecker extends IssuableSubscriptionVisitor {
@Override @Override
public void visitIfStatement(IfStatementTree tree) { public void visitIfStatement(IfStatementTree tree) {
ExpressionTree condition = tree.condition(); ExpressionTree condition = tree.condition();
if(condition instanceof MethodInvocationTree){ condition.accept(new BaseTreeVisitor(){
MethodInvocationTree methodInvocationTree = (MethodInvocationTree) condition; @Override
ExpressionTree expressionTree = methodInvocationTree.methodSelect(); public void visitIdentifier(IdentifierTree tree) {
if(expressionTree instanceof MemberSelectExpressionTreeImpl){ lists.add(tree.name());
MemberSelectExpressionTreeImpl memberSelectExpressionTree = (MemberSelectExpressionTreeImpl) expressionTree;
//将if判断中的参数存入集合中
lists.add(memberSelectExpressionTree.expression().toString());
} }
} });
} }
@Override @Override

Loading…
Cancel
Save