Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-6241

CheckingObjectOutputStream should track the original instance, before writeReplace()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 8.0.0-M1, 7.4.0
    • 8.0.0-M2, 7.5.0
    • wicket
    • None

    Description

      The object passed for checking could be resolved by calling its #writeReplace() method at https://github.com/apache/wicket/blob/379f9e54359be17619be28b0b6303dc9ce3a8e81/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/CheckingObjectOutputStream.java#L374.

      Later the the original instance should be put in the "checked" map because otherwise it might fail with StackoverflowError.

      I our case we have a JPA entity User that has a member field "modifiedBy". When this user is an admin it is possible that it modifies itself. So the original checked instance is a Javassist proxy, after #writeReplace() it is a plain object. Until now the plain object is "checked" and then when its fields are processed the "modifiedBy" is again the same Javassist proxy and the processing continues in loops.

      Attachments

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            mgrigorov Martin Tzvetanov Grigorov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: