Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-781

Bug in CayenneDataObject.readNestedProperty

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2 branch, 2.0 branch, 3.0
    • 3.0M1
    • Core Library
    • None
    • All.

    Description

      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.

      Attachments

        Activity

          People

            blacknext Michael Gentry
            blacknext Michael Gentry
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: