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

Kannan Ekanath (JIRA) jira-events at jboss.com
Thu Oct 19 04:01:41 EDT 2006


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


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