diff --git a/sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/rules/checkers/CmdDataVerifyChecker.java b/sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/rules/checkers/CmdDataVerifyChecker.java index 55ed070..3ae7dc8 100644 --- a/sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/rules/checkers/CmdDataVerifyChecker.java +++ b/sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/rules/checkers/CmdDataVerifyChecker.java @@ -76,11 +76,13 @@ public class CmdDataVerifyChecker extends SquidCheck { for (AstNode expr:astNodeList) { lists.add(expr.getToken().getValue()); } - if(astNodeList.size() == 0){ - List descendants = astNode.getDescendants(CxxGrammarImpl.condition); - for (AstNode desc:descendants) { - lists.add(desc.getToken().getValue()); + List astNodes = astNode.getDescendants(CxxGrammarImpl.relationalExpression); + for (AstNode as:astNodes) { + List children = as.getChildren(); + for (AstNode chil:children) { + lists.add(chil.getTokenValue()); + } } } } diff --git a/sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/rules/checkers/SQLVerifyChecker.java b/sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/rules/checkers/SQLVerifyChecker.java index b7e2726..8bcf8af 100644 --- a/sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/rules/checkers/SQLVerifyChecker.java +++ b/sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/rules/checkers/SQLVerifyChecker.java @@ -77,9 +77,12 @@ public class SQLVerifyChecker extends SquidCheck { lists.add(expr.getToken().getValue()); } if(astNodeList.size() == 0){ - List descendants = astNode.getDescendants(CxxGrammarImpl.condition); - for (AstNode desc:descendants) { - lists.add(desc.getToken().getValue()); + List astNodes = astNode.getDescendants(CxxGrammarImpl.relationalExpression); + for (AstNode as:astNodes) { + List children = as.getChildren(); + for (AstNode chil:children) { + lists.add(chil.getTokenValue()); + } } } }