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 266A019741 for ; Thu, 21 Apr 2016 18:55:26 +0000 (UTC) Received: (qmail 73569 invoked by uid 500); 21 Apr 2016 18:55:25 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 73527 invoked by uid 500); 21 Apr 2016 18:55:25 -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 73513 invoked by uid 99); 21 Apr 2016 18:55:25 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Apr 2016 18:55:25 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 8E99A2C1F5C for ; Thu, 21 Apr 2016 18:55:25 +0000 (UTC) Date: Thu, 21 Apr 2016 18:55:25 +0000 (UTC) From: "Claus Ibsen (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CAMEL-9898) SimpleBuilder throws NullPointerException when replacing string using regexAll method and the regex contains } 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-9898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15252461#comment-15252461 ] Claus Ibsen commented on CAMEL-9898: ------------------------------------ We can improve the parser to support escaping curly-bracket-end so its not mistakenly taken as a function end marker. > SimpleBuilder throws NullPointerException when replacing string using regexAll method and the regex contains } > -------------------------------------------------------------------------------------------------------------- > > Key: CAMEL-9898 > URL: https://issues.apache.org/jira/browse/CAMEL-9898 > Project: Camel > Issue Type: Bug > Components: camel-core > Affects Versions: 2.17.0 > Reporter: Lefteris Tsallas > Assignee: Claus Ibsen > Priority: Minor > > > Add this unit test in org.apache.camel.builder.SimpleBuilderTest to reproduce the issue. Only fails when the regex contains } > {code} > public void testRegexAllWithPlaceHolders() { > exchange.getIn().setHeader("activateUrl", "http://some/rest/api/(id)/activate"); > assertEquals("http://some/rest/api/12/activate",SimpleBuilder.simple("${header.activateUrl.replaceAll(\"\\(id\\)\",\"12\")}").evaluate(exchange,String.class)); > //passes when contains { only > exchange.getIn().setHeader("activateUrl", "http://some/rest/api/{id/activate"); > assertEquals("http://some/rest/api/12/activate",SimpleBuilder.simple("${header.activateUrl.replaceAll(\"\\{id\",\"12\")}").evaluate(exchange,String.class)); > String replaced = "http://some/rest/api/{id}/activate".replaceAll("\\{id\\}","12"); > assertEquals( "http://some/rest/api/12/activate", replaced); > /// But throws throws NullPointerException when regexALl inside a simple expression > exchange.getIn().setHeader("activateUrl", "http://some/rest/api/{id}/activate"); > assertEquals("http://some/rest/api/12/activate",SimpleBuilder.simple("${header.activateUrl.replaceAll(\"\\{id\\}\",\"12\")}").evaluate(exchange,String.class)); > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)