camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [2/2] camel git commit: CAMEL-10085 UnsafeUriCharactersEncoder.checkRAW compiles regex pattern every call
Date Tue, 05 Jul 2016 06:37:49 GMT
CAMEL-10085 UnsafeUriCharactersEncoder.checkRAW compiles regex pattern every call


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bab1c2d2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bab1c2d2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bab1c2d2

Branch: refs/heads/master
Commit: bab1c2d26bc4ca9928dc92382d94f4376ab95747
Parents: c7f2345
Author: Marcin Lachowicz <Marcin.Lachowicz@sabre.com>
Authored: Mon Jul 4 14:53:34 2016 +0200
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Tue Jul 5 08:35:45 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/camel/util/UnsafeUriCharactersEncoder.java | 6 +++---
 .../org/apache/camel/catalog/UnsafeUriCharactersEncoder.java   | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/bab1c2d2/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java
b/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java
index 6ec9e63..3de44f9 100644
--- a/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java
+++ b/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java
@@ -32,6 +32,7 @@ public final class UnsafeUriCharactersEncoder {
     private static BitSet unsafeCharactersHttp;
     private static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8',
'9', 'A', 'B', 'C',
                                               'D', 'E', 'F', 'a', 'b', 'c', 'd', 'e', 'f'};
+    private static Pattern RAW_PATTERN = Pattern.compile("RAW\\([^\\)]+\\)");
 
     static {
         unsafeCharactersRfc1738 = new BitSet(256);
@@ -92,10 +93,9 @@ public final class UnsafeUriCharactersEncoder {
     public static String encodeHttpURI(String s, boolean checkRaw) {
         return encode(s, unsafeCharactersHttp, checkRaw);
     }
-    
+
     private static List<Pair> checkRAW(String s) {
-        Pattern pattern = Pattern.compile("RAW\\([^\\)]+\\)");
-        Matcher matcher = pattern.matcher(s);
+        Matcher matcher = RAW_PATTERN.matcher(s);
         List<Pair> answer = new ArrayList<Pair>();
         // Check all occurrences
         while (matcher.find()) {

http://git-wip-us.apache.org/repos/asf/camel/blob/bab1c2d2/platforms/catalog/src/main/java/org/apache/camel/catalog/UnsafeUriCharactersEncoder.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/UnsafeUriCharactersEncoder.java
b/platforms/catalog/src/main/java/org/apache/camel/catalog/UnsafeUriCharactersEncoder.java
index ce45216..3ba0490 100644
--- a/platforms/catalog/src/main/java/org/apache/camel/catalog/UnsafeUriCharactersEncoder.java
+++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/UnsafeUriCharactersEncoder.java
@@ -32,6 +32,7 @@ public final class UnsafeUriCharactersEncoder {
     private static BitSet unsafeCharactersHttp;
     private static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8',
'9', 'A', 'B', 'C',
         'D', 'E', 'F', 'a', 'b', 'c', 'd', 'e', 'f'};
+    private static Pattern RAW_PATTERN = Pattern.compile("RAW\\([^\\)]+\\)");
 
     static {
         unsafeCharactersRfc1738 = new BitSet(256);
@@ -94,8 +95,7 @@ public final class UnsafeUriCharactersEncoder {
     }
 
     private static List<Pair> checkRAW(String s) {
-        Pattern pattern = Pattern.compile("RAW\\([^\\)]+\\)");
-        Matcher matcher = pattern.matcher(s);
+        Matcher matcher = RAW_PATTERN.matcher(s);
         List<Pair> answer = new ArrayList<Pair>();
         // Check all occurrences
         while (matcher.find()) {


Mime
View raw message