[CID-107552] Unintended regular expression

regex_expected: The . character(s) in the pattern ".md" can match any character, because calls to replaceAll treat the pattern as a regular expression, which might be unexpected.
This commit is contained in:
Kanstantsin Shautsou
2015-03-23 02:35:55 +03:00
parent fc3b6d2c2e
commit f1f96713a4

View File

@@ -673,8 +673,8 @@ public class AppTest extends AbstractGitHubApiTestBase {
public void testTrees() throws IOException {
GHTree masterTree = gitHub.getRepository("kohsuke/github-api").getTree("master");
boolean foundReadme = false;
for(GHTreeEntry e : masterTree.getTree()){
if("readme".equalsIgnoreCase(e.getPath().replaceAll(".md", ""))){
for(GHTreeEntry e : masterTree.getTree()){
if("readme".equalsIgnoreCase(e.getPath().replaceAll("\\.md", ""))){
foundReadme = true;
break;
}