camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] Reopened: (CAMEL-3545) MethodCallExpression doesn't validate whether the method exists for all cases
Date Sat, 15 Jan 2011 16:27:46 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-3545?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Claus Ibsen reopened CAMEL-3545:
--------------------------------


> MethodCallExpression doesn't validate whether the method exists for all cases
> -----------------------------------------------------------------------------
>
>                 Key: CAMEL-3545
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3545
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.5.0
>            Reporter: Christian Müller
>            Assignee: Claus Ibsen
>             Fix For: 2.6.0
>
>
> I tried to refactor
> {code:title=org.apache.camel.model.language.MethodCallExpression.java}
>     public Expression createExpression(CamelContext camelContext) {
>         Expression answer;
>         if (beanType != null) {            
>             instance = ObjectHelper.newInstance(beanType);
>             return new BeanExpression(instance, getMethod(), parameterType); // <--
>         } else if (instance != null) {
>             return new BeanExpression(instance, getMethod(), parameterType); // <--
>         } else {
>             String ref = beanName();
>             // if its a ref then check that the ref exists
>             BeanHolder holder = new RegistryBean(camelContext, ref);
>             // get the bean which will check that it exists
>             instance = holder.getBean();
>             answer = new BeanExpression(ref, getMethod(), parameterType);
>         }
>         // validate method
>         validateHasMethod(camelContext, instance, getMethod(), parameterType);
>         return answer;
>     }
> {code}
> to
> {code:title=org.apache.camel.model.language.MethodCallExpression.java}
>     public Expression createExpression(CamelContext camelContext) {
>         Expression answer;
>         if (beanType != null) {            
>             instance = ObjectHelper.newInstance(beanType);
>             answer = new BeanExpression(instance, getMethod(), parameterType); // <--
>         } else if (instance != null) {
>             answer = new BeanExpression(instance, getMethod(), parameterType); // <--
>         } else {
>             String ref = beanName();
>             // if its a ref then check that the ref exists
>             BeanHolder holder = new RegistryBean(camelContext, ref);
>             // get the bean which will check that it exists
>             instance = holder.getBean();
>             answer = new BeanExpression(ref, getMethod(), parameterType);
>         }
>         // validate method
>         validateHasMethod(camelContext, instance, getMethod(), parameterType);
>         return answer;
>     }
> {code}
> so that the created BeanExpression is also validate if you provide the bean type or an
instance. With this change, some tests in org.apache.camel.language.SimpleTest fails.
> I'm not sure whether the tests are faulty or if it's a bug.
> Also not sure whether this should fixed in 2.6. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message