Return-Path: X-Original-To: apmail-camel-issues-archive@minotaur.apache.org Delivered-To: apmail-camel-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 119D91023B for ; Thu, 3 Oct 2013 10:31:47 +0000 (UTC) Received: (qmail 23840 invoked by uid 500); 3 Oct 2013 10:31:43 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 23719 invoked by uid 500); 3 Oct 2013 10:31:42 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 23673 invoked by uid 99); 3 Oct 2013 10:31:42 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Oct 2013 10:31:42 +0000 Date: Thu, 3 Oct 2013 10:31:42 +0000 (UTC) From: "Claus Ibsen (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CAMEL-6807) Message headers with uppercase letters not matched by jxpath MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CAMEL-6807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13784967#comment-13784967 ] Claus Ibsen commented on CAMEL-6807: ------------------------------------ Thanks for reporting. Do you mind working on an unit test as well? > Message headers with uppercase letters not matched by jxpath > ------------------------------------------------------------ > > Key: CAMEL-6807 > URL: https://issues.apache.org/jira/browse/CAMEL-6807 > Project: Camel > Issue Type: Bug > Components: camel-core > Affects Versions: 2.10.4 > Environment: JXPath used as Expression language > Reporter: Petr Janata > Attachments: CaseInsensitiveMapPropertyHandler.java > > > {{DefaultMessage}} uses {{CaseInsensitiveMap}} for storing headers. If header name contains uppercase characters, then jxpath expression with correct case will not match. > E.g. header named _fooBarBaz_ on "in" message will not be matched by following jxpath expression: > {code:xml} > /in/headers/fooBarBaz = something > {code} > JXPath evaluates nodes that match the fooBarBaz name and uses the keySet() to obtain candidates. The problem is that CaseInsensitiveMap.keySet() returns the converted internal keys, instead of the original keys. > *Is it possible to override the keySet() method of CaseInsensitiveMap to return the original keys?* Then a user will not be unpleasantly surprised that his key is not in the key set. > {code:title=CaseInsensitiveMap.java|borderStyle=solid} > @Override > public Set keySet() > { > return originalKeys.values(); > } > {code} > There are two workarounds possible but neither of them is nice in my eyes. > # use only lowercase header names > # register custom DynamicPropertyHandler in JXPath > Ad 1. this probably wasn't the intention. User must rely on implementation of private method {{CaseInsensitiveMap.assembleKey()}}. This then defeats the purpose of case insensitiveness. > Ad 2. custom property handler must be registered via {{JXPathIntrospector.registerDynamicClass()}} "in the start", e.g. before anybody calls {{JXPathIntrospector.getBeanInfo()}}. In our projects it was enough to declare an extra eagerly-instantiated singleton Spring bean. > {code:xml} > init-method="init" > autowire-candidate="false" > lazy-init="false" /> > {code} -- This message was sent by Atlassian JIRA (v6.1#6144)