Merged DEV to HEAD

48863: ALF-18012 Error occurs on search by wildcards on Start Workflow page
          - []{} symbols escaped in GetAuthoritiesCannedQuery.getPattern(String).
   Also neatened the replacement to be self-documenting


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@48865 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2013-04-05 10:30:37 +00:00
parent 4676411f41
commit d542afaa5c

View File

@@ -119,9 +119,17 @@ public class GetAuthoritiesCannedQuery extends AbstractCannedQueryPermissions<Au
return null;
}
// Escapes: \ with \\ and . with \.
// Replaces ? with . and * with .*
searchValue = "^"+searchValue.replaceAll("\\\\", "\\\\\\\\").replaceAll("\\.", "\\\\.").replaceAll("\\?", ".").replaceAll("\\*", ".*");
// Escape characters of regex expressions
searchValue =
"^" +
searchValue.replaceAll("\\\\", "\\\\\\\\")
.replaceAll("\\.", "\\\\.")
.replaceAll("\\?", ".")
.replaceAll("\\*", ".*")
.replaceAll("\\{", "\\\\{")
.replaceAll("\\}", "\\\\}")
.replaceAll("\\[", "\\\\[")
.replaceAll("\\]", "\\\\]");
return Pattern.compile(searchValue, Pattern.CASE_INSENSITIVE);
}