Sure I can provide a test case. I would just need some direction.

org.exolab.castor.xml.Marshall.java
* $Id: Marshaller.java 5961 2006-06-03 13:02:04Z rjoachim $

I applied the marshalling fixes also.
line: 922
+         if (object instanceof net.sf.cglib.proxy.Factory) {
+                  _class = object.getClass().getSuperclass();
+         }
+         else if (Proxy.isProxyClass(object.getClass()) ) {
-          if (Proxy.isProxyClass(object.getClass()) ) {
               if (LOG.isDebugEnabled()) {
                   LOG.debug("Current object is a proxy class");
               }
XMLMappingLoader mappingLoader = (XMLMappingLoader) _cdResolver.getMappingLoader();
               if (mappingLoader != null) {
                   Class[] interfaces = object.getClass().getInterfaces();
                   for (int i = 0; i < interfaces.length; i++) {
                       Class interfaceClass = interfaces[i];
                       if (LOG.isDebugEnabled()) {
LOG.debug("Looking up interface on proxy: " + interfaceClass.getName());
                       }
ClassDescriptor classDescriptor = mappingLoader.getDescriptor(interfaceClass.getName());
                       if (classDescriptor != null) {
                           if (LOG.isDebugEnabled()) {
LOG.debug("Found mapping for interface " + interfaceClass.getName());
                           }
                           _class = interfaceClass;
                           break;
                       }
                   }
                   if (_class == null) {
                       if (LOG.isDebugEnabled()) {
LOG.debug("No mapped interface found on proxy class ... using proxy class");
                       }

                       _class = object.getClass();
                   }
               } else {
                   if (LOG.isDebugEnabled()) {
                       System.out.println("No XMLMappingLoader found");
                   }
               }
           } else
               _class = object.getClass();
       }

----- Original Message ----- From: "Ralf Joachim" <[EMAIL PROTECTED]>
To: <dev@castor.codehaus.org>
Sent: Monday, September 29, 2008 3:12 AM
Subject: Re: [castor-dev] marshalling lazy loaded class


Hi Stephen,

are you in a position to provide us with a test case to replay the
problem at hand. I view the code fragment as a patch to Marshaller but
which lines in Marshaller do you refer to?

Regards
Ralf


Stephen Ince schrieb:
Castor seems to be not able to marshall classes that are loaded.
I applied the last patch.
http://jira.codehaus.org/browse/CASTOR-1342


I got to work using doing the following.

org.exolab.castor.xml.Marshall.java

               // opendemand fix for marshalling lazy loaded class
(Proxy.isProxyClass) did not work
               if (object instanceof net.sf.cglib.proxy.Factory) {
                  _class = object.getClass().getSuperclass();
               }
             else if (Proxy.isProxyClass(object.getClass()) ) {
:


I have the following lazy loaded configuration.
<class name="com.opendemand.jdo.WebResource" auto-complete="false"
identity="webResourceId" key-generator="keygen" >

:

<field name="response" type="com.opendemand.jdo.WebResourceResponse"
get-method="getResponse" set-method="setResponse" lazy="true">

<sql />

</field>

</class>

Steve

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to