[jboss-jira] [JBoss JIRA] Closed: (JBPM-767) ExpressionEvaluatorHandler has BeanInfo, which does not use the correct set of methods

Tom Baeyens (JIRA) jira-events at jboss.com
Thu Nov 16 07:55:41 EST 2006


     [ http://jira.jboss.com/jira/browse/JBPM-767?page=all ]

Tom Baeyens closed JBPM-767.
----------------------------

    Fix Version/s: jBPM 3.2 alpha 2
       Resolution: Done

added scanning of the superclasses.  I used the getDeclaredMethods on the super class hierarchy to achieve this.  That way, it's also possible to invoke protected and private methods.

> ExpressionEvaluatorHandler has BeanInfo, which does not use the correct set of methods
> --------------------------------------------------------------------------------------
>
>                 Key: JBPM-767
>                 URL: http://jira.jboss.com/jira/browse/JBPM-767
>             Project: JBoss jBPM
>          Issue Type: Bug
>          Components: Core Engine
>    Affects Versions: jBPM 3.1.4
>            Reporter: Kannan Ekanath
>         Assigned To: Tom Baeyens
>             Fix For: jBPM 3.2 alpha 2
>
>
> ExpressionEvaluatorHandler doesnt work in the expected way for subclasses. To quote an example consider,
> public void testSome() {
>         JbpmExpressionEvaluator e = new JbpmExpressionEvaluator();
>         final Book book = new Book();
>         book.setUseful(false);
>         VariableResolver variableResolver = new VariableResolver() {
>             public Object resolveVariable(String pName) throws ELException {
>                 return book;
>             }
>         };
>         e.setVariableResolver(variableResolver);
>         System.out.println(e.evaluate("#{book.isUseful}", new ExecutionContext(new Token())));
>     }
> Carefully note that useful is an attribute, isUseful is the bean getter. The above code works fine. However, if you have any subclass of a book, say for example, replace the line,
> final Book book = new Book();
> final Book book = new MySubclassOfBook();
> Now the same code gives the error, Caused by: org.jbpm.jpdl.el.ELException: Unable to find a value for "isUseful" in object of class "MySubclassOfBook" using operator "." This is because, in bean introspection 
> BeanInfoManager.java --> method initialize(Logger logger)
> void initialize(Logger pLogger) throws ELException {
> ...
>     Method[] methods = mBeanClass.getDeclaredMethods();
>     for (int i=0; i<methods.length; i++) {
>       Method method = methods[i];
> }
> It is using the *getDeclaredMethods()* API and not *getMethods()*. The getdeclaredmethods api gives apis declared only by that class and not inherited ones.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list