Skip to content

Commit

Permalink
MODE-2438 Added escaping for the + character when used in getNodes() …
Browse files Browse the repository at this point in the history
…regexp.
  • Loading branch information
Horia Chiorean committed Mar 24, 2015
1 parent 9ff1b6c commit 310460f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@ protected static List<?> createPatternsFor( String... namePatterns ) {
case '.':
case '{':
case '}':
case '+':
case '\\':
sb.append("\\");
sb.append(c);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,10 @@ public void shouldAllowSearchingForSNSViaRegex() throws Exception {
}

@Test
@FixFor("MODE-2069")
@FixFor( { "MODE-2069", "MODE-2438" } )
public void shouldEscapeSpecialCharactersWhenSearchingNodesViaRegex() throws Exception {
JcrRootNode rootNode = session.getRootNode();
Node specialNode = rootNode.addNode("special\t\r\n()\\?!^${}.\"");
Node specialNode = rootNode.addNode("special\t\r\n()\\?!^${}.\"+");
session.save();

try {
Expand All @@ -481,6 +481,7 @@ public void shouldEscapeSpecialCharactersWhenSearchingNodesViaRegex() throws Exc
assertEquals(1, rootNode.getNodes("*{}*").getSize());
assertEquals(1, rootNode.getNodes("*.*").getSize());
assertEquals(1, rootNode.getNodes("*\"*").getSize());
assertEquals(1, rootNode.getNodes("*+*").getSize());

assertEquals(0, rootNode.getNodes("*[*").getSize());
assertEquals(0, rootNode.getNodes("*]*").getSize());
Expand Down

0 comments on commit 310460f

Please sign in to comment.