Skip to content

Commit 3efb767

Browse files
committed
Fixed flakyness of RegexInjectionRemediator
1 parent f0686f7 commit 3efb767

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

framework/codemodder-base/src/main/java/io/codemodder/remediation/DefaultFixCandidateSearcher.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ public FixCandidateSearchResults<T> search(
7373
n, issueStartLine, issueEndLine, column))
7474
.orElse(nodePositionMatcher.match(n, issueStartLine, issueEndLine)))
7575
.toList();
76+
System.out.println(issueStartLine);
77+
System.out.println(maybeColumn);
78+
System.out.println(nodesForIssue);
7679
if (nodesForIssue.isEmpty()) {
7780
continue;
7881
}

framework/codemodder-base/src/main/java/io/codemodder/remediation/regexinjection/RegexInjectionRemediator.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ public SuccessOrReason fix(final CompilationUnit cu, final Node node) {
6363
}
6464
}
6565

66-
/** Check if its a {@link Pattern#compile(String)} call. */
66+
/** Check if it's a {@link Pattern#compile(String)} call. */
6767
private static boolean isCompileCall(final MethodCallExpr methodCallExpr) {
68-
return methodCallExpr.getNameAsString().equals("compile")
69-
&& methodCallExpr.getArguments().size() == 1
70-
|| methodCallExpr.getArguments().size() == 2
71-
&& !methodCallExpr.getArguments().get(0).isStringLiteralExpr();
68+
return "compile".equals(methodCallExpr.getNameAsString())
69+
&& (methodCallExpr.getArguments().size() == 1
70+
|| (methodCallExpr.getArguments().size() == 2
71+
&& !methodCallExpr.getArguments().get(0).isStringLiteralExpr()));
7272
}
7373

7474
/** Check if its a {@link String#replaceFirst(String, String)} call. */

0 commit comments

Comments
 (0)