[JIRA] Created: (CAY-781) Bug in CayenneDataObject.readNestedProperty

From: Michael Gentry (JIRA) ("Michael)
Date: Wed Apr 25 2007 - 09:37:44 EDT

  • Next message: Michael Gentry: "Re: [JIRA] Created: (CAY-781) Bug in CayenneDataObject.readNestedProperty"

    Bug in CayenneDataObject.readNestedProperty
    -------------------------------------------

                     Key: CAY-781
                     URL: https://issues.apache.org/cayenne/browse/CAY-781
                 Project: Cayenne
              Issue Type: Bug
              Components: Cayenne Core Library
        Affects Versions: 1.2 [STABLE], 2.0 [STABLE], 3.0
             Environment: All.
                Reporter: Michael Gentry
             Assigned To: Michael Gentry
                 Fix For: 1.2 [STABLE], 2.0 [STABLE], 3.0

    CayenneDataObject.readNestedProperty is supposed to be able to handle Cayenne attributes (mapped and unmapped) and additionally use reflection to find derived values consistent with JavaBeans specifications.

    Given a property of "transaction.productLine.name" where:

        transaction => CayenneDataObject
        productLine => ProductLine object (POJO)
        name => attribute of ProductLine obtained by getName()

    readNestedProperty fails because when Cayenne tries to read the name using reflection, the path it tries to parse is "e.name" instead of "name". The math is incorrect to find the start of the "name" property:

                else if (i + 1 < length) {
                    // read the rest of the path via introspection
                    return PropertyUtils.getProperty(object, path.substring(pathIndex));

    The pathIndex variable has an incorrect value and the substring is off. It is off by 1 for every "." in the path.

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



    This archive was generated by hypermail 2.0.0 : Wed Apr 25 2007 - 09:38:10 EDT