QPID-7892: [Java Broker] Use Pattern#quote instead of own regexp escaping

Cherry picked from 6.1.x b1eecae10f741f1564d1b04982da6be3427481e4


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/f3bfcd82
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/f3bfcd82
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/f3bfcd82

Branch: refs/heads/6.0.x
Commit: f3bfcd8284c67547a0064a672483915c01264955
Parents: d9f3515
Author: Alex Rudyy <[email protected]>
Authored: Mon Sep 4 13:02:43 2017 +0100
Committer: Keith Wall <[email protected]>
Committed: Wed Nov 22 16:06:04 2017 +0000

----------------------------------------------------------------------
 .../qpid/server/logging/logback/RollingPolicyDecorator.java  | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/f3bfcd82/broker-core/src/main/java/org/apache/qpid/server/logging/logback/RollingPolicyDecorator.java
----------------------------------------------------------------------
diff --git 
a/broker-core/src/main/java/org/apache/qpid/server/logging/logback/RollingPolicyDecorator.java
 
b/broker-core/src/main/java/org/apache/qpid/server/logging/logback/RollingPolicyDecorator.java
index 0d20a22..2d56156 100644
--- 
a/broker-core/src/main/java/org/apache/qpid/server/logging/logback/RollingPolicyDecorator.java
+++ 
b/broker-core/src/main/java/org/apache/qpid/server/logging/logback/RollingPolicyDecorator.java
@@ -295,7 +295,6 @@ public class RollingPolicyDecorator implements RollingPolicy
 
     private static class FilePathBaseFolderAndPatternPair
     {
-        private static Pattern REGEX_SPECIAL_CHARACTERS = 
Pattern.compile("[{}()\\[\\].+*?^$\\\\|]");
         private final Path _baseFolder;
         private final Pattern _pattern;
 
@@ -318,12 +317,7 @@ public class RollingPolicyDecorator implements 
RollingPolicy
                 path = System.getProperty("user.dir");
             }
             _baseFolder = new File(path).toPath().toAbsolutePath();
-            _pattern = Pattern.compile(escape(path) + "/" + fileNamePattern);
-        }
-
-        private String escape(String string)
-        {
-            return 
REGEX_SPECIAL_CHARACTERS.matcher(string).replaceAll("\\\\$0");
+            _pattern = Pattern.compile(Pattern.quote(path) + "/" + 
fileNamePattern);
         }
 
         public Path getBaseFolder()


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to