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

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