castor
  1. castor
  2. CASTOR-1342

Proxied classes need to be identified and receive special processing

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0 M3
    • Fix Version/s: 1.2
    • Component/s: XML
    • Labels:
      None
    • Number of attachments :
      5

      Description

      Proxy classes (usually via CGLIB proxies) need to be identified as proxies and treated in such a way that the proxy enhancements do not interfere with marshalling/unmarshalling. Two different issues have arisen with proxies:

      http://www.mail-archive.com/user@castor.codehaus.org/msg02345.html
      http://www.mail-archive.com/user@castor.codehaus.org/msg02489.html

      First and foremost, Castor needs to identify when an object/class is a proxy instead of the real thing. According to the CGLIB mailing list:

      http://sourceforge.net/mailarchive/message.php?msg_id=9827333

      this can be done by finding if a class is an implementation of the net.sf.cglib.proxy.Factory interface (this may need to be user adjustable for other proxying libraries – if there are any).

      Once the proxy has been identified, this issue may need to be split into three sub-issues:

      1. Looking up ClassDescriptors based on a proxy class (get the proxy's superclass to look up?)
      2. Introspecting proxy classes (don't introspect the proxy, introspect the original?)
      3. Mapping proxy classes (not sure about this one... maybe the previous two will solve this one)

        Activity

        Hide
        paul grillo added a comment -

        Before I open another bug, i'd like to comment here for those that are listening.

        This patch handled the original problem reported so that Castor will use the un-proxied class when marshalling.

        Now that Castor has this information (when configured properly, as I have), there is an additional problem.

        If a class is mapped in castor as a reference, with a key,

        org.exolab.castor.xml.Marshaller makes a call to getObjectID and passes the incoming Object. The Class Name of that Object is used to look up the class descriptor and field descriptor to get the mapping to fetch the object ID (key).

        this fails for objects that have been proxied, as the classname is not known to Castor Marshaller and thus the Class Descriptor cannot be found.

        Has anybody run into this? Does this make sense? Shall i Open a JIRA?

        I have unsuccessfully tried for a couple of hours to build Castor1.2 from source file today to try patching this area so as to ensure that the "unproxied" class is sent.

        I will continue to do so.

        Show
        paul grillo added a comment - Before I open another bug, i'd like to comment here for those that are listening. This patch handled the original problem reported so that Castor will use the un-proxied class when marshalling. Now that Castor has this information (when configured properly, as I have), there is an additional problem. If a class is mapped in castor as a reference, with a key, org.exolab.castor.xml.Marshaller makes a call to getObjectID and passes the incoming Object. The Class Name of that Object is used to look up the class descriptor and field descriptor to get the mapping to fetch the object ID (key). this fails for objects that have been proxied, as the classname is not known to Castor Marshaller and thus the Class Descriptor cannot be found. Has anybody run into this? Does this make sense? Shall i Open a JIRA? I have unsuccessfully tried for a couple of hours to build Castor1.2 from source file today to try patching this area so as to ensure that the "unproxied" class is sent. I will continue to do so.
        Hide
        Ralf Joachim added a comment -

        Paul, it may be possible that we missed to care for the proxies at some areas. Can you please raise a new issue and attach a minimal test that allows me to reproduce things. Having said that a test case that requires hibernate is not an option to me.

        Show
        Ralf Joachim added a comment - Paul, it may be possible that we missed to care for the proxies at some areas. Can you please raise a new issue and attach a minimal test that allows me to reproduce things. Having said that a test case that requires hibernate is not an option to me.
        Hide
        Werner Guttmann added a comment -

        I have unsuccessfully tried for a couple of hours to build Castor1.2 from source file today to try patching this area so as to ensure that the "unproxied" class is sent.

        Paul, unfortunately, the 1.2 source distribution do miss one or two modules, something that has been reported immediately after the release and has been fixed in SVN.

        Show
        Werner Guttmann added a comment - I have unsuccessfully tried for a couple of hours to build Castor1.2 from source file today to try patching this area so as to ensure that the "unproxied" class is sent. Paul, unfortunately, the 1.2 source distribution do miss one or two modules, something that has been reported immediately after the release and has been fixed in SVN.
        Hide
        Ralf Joachim added a comment -

        Name of attachment 'patch.c1342.20080827.txt' leads users to use it as latest patch but it is a very old one from 2006. I intend to remove this attachment.

        Show
        Ralf Joachim added a comment - Name of attachment 'patch.c1342.20080827.txt' leads users to use it as latest patch but it is a very old one from 2006. I intend to remove this attachment.
        Hide
        Ralf Joachim added a comment -

        Removed old attachment 'patch.c1342.20080827.txt'.

        Show
        Ralf Joachim added a comment - Removed old attachment 'patch.c1342.20080827.txt'.

          People

          • Assignee:
            Ralf Joachim
            Reporter:
            Stephen Bash
          • Votes:
            7 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: