camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Using Simple language in Spring XML, String.replaceAll with regex grouping throws Exception
Date Wed, 18 Mar 2015 18:41:35 GMT
Yes it should be fixed in Camel 2.15.1

On Wed, Mar 18, 2015 at 7:30 PM, meetdevang <meetdevang@gmail.com> wrote:
> Hi,
>
> Based on the
> http://camel.465427.n5.nabble.com/String-replacement-via-Spring-td5719498.html
> I am sucessfully able to run a simple example of String.replaceAll
>
> However, when I attempt to execute the route
>                 <route id="testtransform">
>                         <from uri="file://input" />
>                         <convertBodyTo type="java.lang.String"/>
>                         <transform>
>                                 <simple>${body.replaceAll("foo([A-Z])bar", "bar$1foo")}</simple>
>                         </transform>
>                         <to uri="file://transformed" />
>                 </route>
>
> I get the following exception
> Stacktrace
> ---------------------------------------------------------------------------------------------------------------------------------------
> org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to
> invoke method: .replaceAll("foo([A-Z])bar", "bar$1foo") on null due to:
> org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to
> invoke method: replaceAll("foo([A-Z])bar", "bar$1foo") on null due to:
> java.util.regex.PatternSyntaxException: Unclosed group near index 10
> "foo([A-Z]
>           ^
>         at
> org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:117)
>         at
> org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:132)
>         at
> org.apache.camel.model.language.ExpressionDefinition.evaluate(ExpressionDefinition.java:121)
>         at
> org.apache.camel.model.language.ExpressionDefinition.evaluate(ExpressionDefinition.java:113)
>         at
> org.apache.camel.builder.ExpressionBuilder$33.evaluate(ExpressionBuilder.java:822)
>         at
> org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36)
>         at org.apache.camel.builder.SimpleBuilder.evaluate(SimpleBuilder.java:83)
>         at
> org.apache.camel.processor.TransformProcessor.process(TransformProcessor.java:47)
>         at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
>         at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
>         at
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:423)
>         at
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:211)
>         at
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:175)
>         at
> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)
>         at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)
>         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>         at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
>         at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
>         at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>         at java.lang.Thread.run(Thread.java:744)
> Caused by: org.apache.camel.language.bean.RuntimeBeanExpressionException:
> Failed to invoke method: replaceAll("foo([A-Z])bar", "bar$1foo") on null due
> to: java.util.regex.PatternSyntaxException: Unclosed group near index 10
> "foo([A-Z]
>           ^
>         at
> org.apache.camel.language.bean.BeanExpression$OgnlInvokeProcessor.process(BeanExpression.java:285)
>         at
> org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:114)
>         ... 25 more
> Caused by: java.util.regex.PatternSyntaxException: Unclosed group near index
> 10
> "foo([A-Z]
>           ^
>         at java.util.regex.Pattern.error(Pattern.java:1924)
>         at java.util.regex.Pattern.accept(Pattern.java:1782)
>         at java.util.regex.Pattern.group0(Pattern.java:2857)
>         at java.util.regex.Pattern.sequence(Pattern.java:2018)
>         at java.util.regex.Pattern.expr(Pattern.java:1964)
>         at java.util.regex.Pattern.compile(Pattern.java:1665)
>         at java.util.regex.Pattern.<init>(Pattern.java:1337)
>         at java.util.regex.Pattern.compile(Pattern.java:1022)
>         at java.lang.String.replaceAll(String.java:2162)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
>         at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:408)
>         at
> org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:279)
>         at
> org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:252)
>         at
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:167)
>         at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:105)
>         at
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:67)
>         at
> org.apache.camel.language.bean.BeanExpression$InvokeProcessor.process(BeanExpression.java:189)
>         at
> org.apache.camel.language.bean.BeanExpression$OgnlInvokeProcessor.process(BeanExpression.java:281)
>         ... 26 more
>
> Is this a bug in the ObjectHelper.between method which looks for the first
> instance of the ')' and hence doesn't really parse the arguments correctly?
> Or Am I missing something?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Using-Simple-language-in-Spring-XML-String-replaceAll-with-regex-grouping-throws-Exception-tp5764367.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Mime
View raw message