Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-789

SerializationUtils clone method fails to perform some deep cloning

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 3.1
    • None
    • lang.*
    • Windows 7, Java 7 (1.7.0_03), Apache Commons Lang 3.1, NetBeans 7.1

    Description

      SerializationUtils clone method fails to perform some deep cloning of at least some objects containing Externalizable subobjects.

      Here is the @version text from the SerializationUtils.java source file:

      SerializationUtils.java 1199718 2011-11-09 12:43:20Z sebb $

      To reproduce possible bug:

      1. Create two classes (let's call them Parent and Child) and mark both as "implements Externalizable".

      2. Write required Externalizable methods readExternal and writeExternal

      3. Make Child a private member/field of Parent

      4. Write code to override toString if necessary for Parent and Child

      5. Create a separate Java class to test creation and cloning of Parent and Child

      6. In the test class write to code to do this:
      a. Create a Parent object
      b. Create a Child object
      c. Attach Child to Parent via setter
      d. Print out Parent object
      e. Use SerializationUtils.clone() to clone Parent (call it ParentClone)
      f. Print ParentClone

      7. Compare print output of Parent and ParentClone, observe that ParentClone does not contain Child object

      Attachments

        Activity

          People

            Unassigned Unassigned
            akubot Harry Levinson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: