Uploaded image for project: 'OJB'
  1. OJB
  2. OJB-143

PersistentFieldIntrospectorImpl and PersistentFieldCGLibImpl don't work for nested objects when reference was modified by its setter method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.0.4, 1.0.5
    • 1.0.4, 1.0.5
    • PB-API
    • None
    • any

    Description

      Both PersistentField implementations that use JavaBeans compliant calls (PersistentFieldIntrospectorImpl and PersistentFieldCGLibImpl) fail if nested object reference was modified by its setter method.

      Both classes implement PersistentField.set(Object, Object) in a similar way. Problem arises because internally in this method the reference to a nested object (see "attribute" local variable) will be held and used after actual setter method was called and thus performing further steps (like setting rest in "propertyGraph") on potentially "old" (wrong) reference.

      This Problem is reproducible by introducing a clone() method for NestedEntry in org.apache.ojb.broker.metadata.PersistentFieldTest and altering NestedMain's setNestedEntry(NestedEntry) by setting private "nestedEntry" with a clone instead of actual method parameter:

      this.nestedEntryXXX = (NestedEntry) nestedEntry.clone();

      After performing those changes on PersistentFieldTest following two use-cases fail:

      • testIntrospector() and
      • testAutoProxy() (since PersistentFieldCGLibImpl is used in that use-case).

      Attachments

        1. mylyn-context.zip
          2 kB
          Mario Curcija
        2. PersistentField-patch.diff
          2 kB
          Mario Curcija
        3. PersistentFieldTest-patch.diff
          1 kB
          Mario Curcija

        Activity

          People

            Unassigned Unassigned
            mcurcija Mario Curcija
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: