Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 15E83200B46 for ; Fri, 1 Jul 2016 09:24:13 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 149FB160A61; Fri, 1 Jul 2016 07:24:13 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 69A97160A6C for ; Fri, 1 Jul 2016 09:24:12 +0200 (CEST) Received: (qmail 54387 invoked by uid 500); 1 Jul 2016 07:24:11 -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 54195 invoked by uid 99); 1 Jul 2016 07:24:11 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Jul 2016 07:24:11 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 144172C02A4 for ; Fri, 1 Jul 2016 07:24:11 +0000 (UTC) Date: Fri, 1 Jul 2016 07:24:11 +0000 (UTC) From: "Claus Ibsen (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CAMEL-10085) UnsafeUriCharactersEncoder.checkRAW compiles regex pattern every call MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 01 Jul 2016 07:24:13 -0000 [ https://issues.apache.org/jira/browse/CAMEL-10085?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Claus Ibsen updated CAMEL-10085: -------------------------------- Fix Version/s: (was: 2.17.2) 2.17.3 > UnsafeUriCharactersEncoder.checkRAW compiles regex pattern every call > ---------------------------------------------------------------------- > > Key: CAMEL-10085 > URL: https://issues.apache.org/jira/browse/CAMEL-10085 > Project: Camel > Issue Type: Improvement > Affects Versions: 2.17.1 > Reporter: Mateusz Nowakowski > Assignee: Andrea Cosentino > Priority: Minor > Fix For: 2.17.3, 2.18.0 > > > UnsafeUriCharactersEncoder.checkRAW compile regex pattern every time it is called (and it is called really often due to stack: > DefaultCamelContext.normalizeEndpointUri() -> URISUpport.normalizeUri() -> org.apache.camel.util.UnsafeUriCharactersEncoder.encode() -> checkRaw() -> Pattern.compile()) > Under high load it leads to decrease performance. > The easiest fix is to precompile pattern: > {code} > private static Pattern RAW_PATTERN = Pattern.compile("RAW\\([^\\)]+\\)"); > (....) > private static List checkRAW(String s) { > Matcher matcher = RAW_PATTERN.matcher(s); > List answer = new ArrayList(); > // Check all occurrences > while (matcher.find()) { > answer.add(new Pair(matcher.start(), matcher.end())); > } > return answer; > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)