QPID-7892: [Java Broker] Use Pattern#quote instead of own regexp escaping Cherry picked from master 11a74ca.
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/b1eecae1 Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/b1eecae1 Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/b1eecae1 Branch: refs/heads/6.1.x Commit: b1eecae10f741f1564d1b04982da6be3427481e4 Parents: b3a65d5 Author: Alex Rudyy <[email protected]> Authored: Mon Sep 4 13:02:43 2017 +0100 Committer: Keith Wall <[email protected]> Committed: Wed Nov 22 15:48:36 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/b1eecae1/broker-plugins/logging-logback/src/main/java/org/apache/qpid/server/logging/logback/RollingPolicyDecorator.java ---------------------------------------------------------------------- diff --git a/broker-plugins/logging-logback/src/main/java/org/apache/qpid/server/logging/logback/RollingPolicyDecorator.java b/broker-plugins/logging-logback/src/main/java/org/apache/qpid/server/logging/logback/RollingPolicyDecorator.java index 0d20a22..2d56156 100644 --- a/broker-plugins/logging-logback/src/main/java/org/apache/qpid/server/logging/logback/RollingPolicyDecorator.java +++ b/broker-plugins/logging-logback/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]
