Hi,

We're using plugins similar to Eclipse's to decouple functionality. Each 
plugin's classes run in their own class loader.

We've encountered a problem in onNewBrowserWindow(). it uses 
Objects.cloneObject(), which uses the default ObjectInputStream, that uses the 
class loader associated with the execution stack, rather than the object's. so 
trying to get the class of the object when reading it back fails.

This can be solved by changing cloneObject to:
public static Object cloneObject(final Object object)
   {
       if (object == null)
       {
           return null;
       }
       else
       {
           try
           {
               final ByteArrayOutputStream out = new ByteArrayOutputStream(256);
               ObjectOutputStream oos = new ObjectOutputStream(out);
               oos.writeObject(object);
               ObjectInputStream ois = new ObjectInputStream(new 
ByteArrayInputStream(out
                       .toByteArray())) {
                                      protected Class 
resolveClass(ObjectStreamClass desc) throws IOException,
                   ClassNotFoundException {
                       String className = desc.getName();
                       return Class.forName(className, true, 
object.getClass().getClassLoader());                     }
               };
               return ois.readObject();
           }
           catch (ClassNotFoundException e)
           {
               throw new WicketRuntimeException("Internal error cloning 
object", e);
           }
           catch (IOException e)
           {
               throw new WicketRuntimeException("Internal error cloning 
object", e);
           }
       }
   } 

i think that it should work fine in this context since the object is already 
accessible when writing it. it is working for us. 

btw, a problem that is caused by this failure (and the throwing of 
WicketRuntimeException) is that the PageMap contains null entries (or rather, 
the session contains attributes with null values). i couldn't track why exactly 
this happens.

regards,
ittay



-- 
===================================
Ittay Dror, 
Chief architect, openQRM TL, 
R&D, Qlusters Inc.
[EMAIL PROTECTED]
+972-3-6081994 Fax: +972-3-6081841

http://www.openQRM.org
- Keeps your Data-Center Up and Running


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to