camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-7294) Simple Language - Accessing hashCode
Date Fri, 14 Mar 2014 07:07:45 GMT

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

Claus Ibsen commented on CAMEL-7294:
------------------------------------

This is by design, we exclude a number of methods in simple language

    static {
        // exclude all java.lang.Object methods as we dont want to invoke them
        EXCLUDED_METHODS.addAll(Arrays.asList(Object.class.getMethods()));
        // exclude all java.lang.reflect.Proxy methods as we dont want to invoke them
        EXCLUDED_METHODS.addAll(Arrays.asList(Proxy.class.getMethods()));
        try {
            // but keep toString as this method is okay
            EXCLUDED_METHODS.remove(Object.class.getMethod("toString"));
            EXCLUDED_METHODS.remove(Proxy.class.getMethod("toString"));
        } catch (Throwable e) {
            // ignore
        }
    }


> Simple Language - Accessing hashCode 
> -------------------------------------
>
>                 Key: CAMEL-7294
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7294
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 2.12.3
>            Reporter: Alan Foster
>            Assignee: Willem Jiang
>
> With the following blueprint route
> {code:xml}
>     <camelContext trace="false" xmlns="http://camel.apache.org/schema/blueprint">
>         <route>
>             <from uri="direct:entry"/>
>             <setBody>
>                 <simple>Hello World</simple>
>             </setBody>
>             <log message="The current body is :: ${body}" />
>             <setBody>
>                 <simple>${body.hashCode}</simple>
>             </setBody>
>             <log message="The id hashcode is : ${body}" />
>         </route>
>     </camelContext>
> {code}
> The following exception occurs
> {code}
> org.apache.camel.CamelExecutionException: Exception occurred during execution on the
exchange: Exchange[Message: Hello World]
> 	at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1379)
> 	at org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:622)
> 	at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:467)
> 	at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:463)
> 	at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:139)
> 	at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:144)
> 	at camel.SimpleEqualsTest.testRoute(SimpleEqualsTest.java:30)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
> 	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> 	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
> 	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
> 	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
> 	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
> 	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
> 	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
> 	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
> 	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
> 	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
> 	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
> 	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
> 	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
> 	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
> 	at org.junit.runners.Suite.runChild(Suite.java:127)
> 	at org.junit.runners.Suite.runChild(Suite.java:26)
> 	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
> 	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
> 	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
> 	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
> 	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
> 	at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
> 	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
> 	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:202)
> 	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
> Caused by: org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to invoke
method: .hashCode on null due to: org.apache.camel.language.bean.RuntimeBeanExpressionException:
Failed to invoke method: hashCode on null due to: org.apache.camel.component.bean.MethodNotFoundException:
Method with name: hashCode not found on bean: Hello World of type: java.lang.String. Exchange[Message:
Hello World]
> 	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:821)
> 	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.SetBodyProcessor.process(SetBodyProcessor.java:46)
> 	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.direct.DirectProducer.process(DirectProducer.java:51)
> 	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
> 	at org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:73)
> 	at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:378)
> 	at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:346)
> 	at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:242)
> 	at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:346)
> 	at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:184)
> 	at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:124)
> 	at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:137)
> 	... 41 more
> Caused by: org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to invoke
method: hashCode on null due to: org.apache.camel.component.bean.MethodNotFoundException:
Method with name: hashCode not found on bean: Hello World of type: java.lang.String. Exchange[Message:
Hello World]
> 	at org.apache.camel.language.bean.BeanExpression$OgnlInvokeProcessor.process(BeanExpression.java:285)
> 	at org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:114)
> 	... 63 more
> Caused by: org.apache.camel.component.bean.MethodNotFoundException: Method with name:
hashCode not found on bean: Hello World of type: java.lang.String. Exchange[Message: Hello
World]
> 	at org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:264)
> 	at org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:180)
> 	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:148)
> 	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)
> 	... 64 more
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message