mirror of
https://github.com/github/codeql.git
synced 2026-04-24 00:05:14 +02:00
Merge pull request #19560 from owen-mc/java/add-stringreplaceallwithnonregex-test
Java: Add test showing correct usage
This commit is contained in:
@@ -18,6 +18,7 @@ public class Test {
|
||||
String s1 = "test";
|
||||
s1 = s1.replaceAll("t", "x"); // NON_COMPLIANT
|
||||
s1 = s1.replaceAll(".*", "x"); // COMPLIANT
|
||||
s1 = s1.replace("t", "x"); // COMPLIANT
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,5 +3,6 @@ public class Test {
|
||||
String s1 = "test";
|
||||
s1 = s1.replaceAll("t", "x"); // $ Alert // NON_COMPLIANT
|
||||
s1 = s1.replaceAll(".*", "x"); // COMPLIANT
|
||||
s1 = s1.replace("t", "x"); // COMPLIANT
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user