You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Thomas Diesler (JIRA)" <ji...@apache.org> on 2019/01/18 10:30:00 UTC

[jira] [Commented] (CAMEL-13078) Cannot convert "random(500)" to Integer

    [ https://issues.apache.org/jira/browse/CAMEL-13078?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16746141#comment-16746141 ] 

Thomas Diesler commented on CAMEL-13078:
----------------------------------------

In camel-2.23.x the code runs through

{code}
    	Expression exprB = SimpleBackwardsCompatibleParser.parseExpression("random(500)", false);
    	Integer resB = exprB.evaluate(exchange, Integer.class);
{code}

In camel-3.0.x it uses 

{code}
    	SimpleExpressionParser parser = new SimpleExpressionParser("random(500)");
    	Expression exprA = parser.parseExpression();
    	Integer resA = exprA.evaluate(exchange, Integer.class);
{code}

The latter fails. Is perhaps that expression syntax no longer supported?


> Cannot convert "random(500)" to Integer
> ---------------------------------------
>
>                 Key: CAMEL-13078
>                 URL: https://issues.apache.org/jira/browse/CAMEL-13078
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Thomas Diesler
>            Assignee: Thomas Diesler
>            Priority: Major
>             Fix For: 3.0.0
>
>
> {code}
> 09:45:22,113 ERROR [org.apache.camel.component.reactive.streams.ReactiveStreamsCamelSubscriber] (Camel (camel-2) thread #3 - timer://tick) Error in reactive stream 'sub1': org.apache.camel.TypeConversionException: Error during type conversion from type: java.lang.String to the required type: java.lang.Integer with value random(500) due to java.lang.NumberFormatException: For input string: "random(500)"
> 	at org.apache.camel.impl.converter.CoreStaticTypeConverterLoader$SimpleTypeConverter.convertTo(CoreStaticTypeConverterLoader.java:34)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:265)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:162)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:129)
> 	at org.apache.camel.support.MessageSupport.getBody(MessageSupport.java:85)
> 	at org.apache.camel.support.MessageSupport.getBody(MessageSupport.java:59)
> 	at org.apache.camel.component.reactive.streams.util.BodyConverter.apply(BodyConverter.java:41)
> 	at io.reactivex.internal.operators.flowable.FlowableMap$MapSubscriber.onNext(FlowableMap.java:63)
> 	at io.reactivex.processors.MulticastProcessor$MulticastSubscription.onNext(MulticastProcessor.java:624)
> 	at io.reactivex.processors.MulticastProcessor.drain(MulticastProcessor.java:530)
> 	at io.reactivex.processors.MulticastProcessor.onNext(MulticastProcessor.java:302)
> 	at io.reactivex.internal.operators.flowable.FlowableOnBackpressureBuffer$BackpressureBufferSubscriber.onNext(FlowableOnBackpressureBuffer.java:110)
> 	at io.reactivex.internal.operators.flowable.FlowableDoAfterNext$DoAfterSubscriber.onNext(FlowableDoAfterNext.java:62)
> 	at io.reactivex.internal.operators.flowable.FlowableCreate$MissingEmitter.onNext(FlowableCreate.java:367)
> 	at org.apache.camel.component.rxjava2.engine.RxJavaCamelProcessor.send(RxJavaCamelProcessor.java:100)
> 	at org.apache.camel.component.rxjava2.engine.RxJavaStreamsService.sendCamelExchange(RxJavaStreamsService.java:284)
> 	at org.apache.camel.component.reactive.streams.ReactiveStreamsProducer.process(ReactiveStreamsProducer.java:52)
> 	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:131)
> 	at org.apache.camel.processor.RedeliveryErrorHandler$RedeliveryState.run(RedeliveryErrorHandler.java:481)
> 	at org.apache.camel.support.ReactiveHelper$Worker.schedule(ReactiveHelper.java:130)
> 	at org.apache.camel.support.ReactiveHelper.schedule(ReactiveHelper.java:51)
> 	at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:178)
> 	at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:76)
> 	at java.util.TimerThread.mainLoop(Timer.java:555)
> 	at java.util.TimerThread.run(Timer.java:505)
> Caused by: java.lang.NumberFormatException: For input string: "random(500)"
> 	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
> 	at java.lang.Integer.parseInt(Integer.java:580)
> 	at java.lang.Integer.valueOf(Integer.java:766)
> 	at org.apache.camel.converter.ObjectConverter.toInteger(ObjectConverter.java:158)
> 	at org.apache.camel.impl.converter.CoreStaticTypeConverterLoader$57.doConvert(CoreStaticTypeConverterLoader.java:382)
> 	at org.apache.camel.impl.converter.CoreStaticTypeConverterLoader$SimpleTypeConverter.convertTo(CoreStaticTypeConverterLoader.java:30)
> 	... 24 more
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)