This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-3.7.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.7.x by this push:
new 970fbf9 CAMEL-16202: camel-core - Optimize
DefaultHeaderFilterStrategy filtering
970fbf9 is described below
commit 970fbf9e1a5e4bdf1a58d5c783187ab89959bea8
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Feb 14 13:40:22 2021 +0100
CAMEL-16202: camel-core - Optimize DefaultHeaderFilterStrategy filtering
---
.../apache/camel/support/DefaultHeaderFilterStrategy.java | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git
a/core/camel-support/src/main/java/org/apache/camel/support/DefaultHeaderFilterStrategy.java
b/core/camel-support/src/main/java/org/apache/camel/support/DefaultHeaderFilterStrategy.java
index fa1ad2a..35674d4 100644
---
a/core/camel-support/src/main/java/org/apache/camel/support/DefaultHeaderFilterStrategy.java
+++
b/core/camel-support/src/main/java/org/apache/camel/support/DefaultHeaderFilterStrategy.java
@@ -275,16 +275,11 @@ public class DefaultHeaderFilterStrategy implements
HeaderFilterStrategy {
filter = inFilter;
}
- String lower = null;
if (pattern != null) {
// optimize if its the default pattern as we know the pattern is
to check for keys starting with Camel
if (pattern == CAMEL_FILTER_PATTERN) {
- boolean match = headerName.startsWith("org.apache.camel.") ||
headerName.startsWith("Camel");
- if (!match) {
- // the default filter is case insensitive so check for
lower case starting match
- lower = headerName.toLowerCase(Locale.ENGLISH);
- match = lower.startsWith("org.apache.camel.") ||
lower.startsWith("camel");
- }
+ boolean match = headerName.startsWith("Camel") ||
headerName.startsWith("camel")
+ || headerName.startsWith("org.apache.camel.");
if (match) {
return filterOnMatch;
}
@@ -301,9 +296,7 @@ public class DefaultHeaderFilterStrategy implements
HeaderFilterStrategy {
}
}
} else if (isLowerCase()) {
- if (lower == null) {
- lower = headerName.toLowerCase(Locale.ENGLISH);
- }
+ String lower = headerName.toLowerCase(Locale.ENGLISH);
if (filter.contains(lower)) {
return filterOnMatch;
}