Hi,

A small patch is required for model versioning to work for wicket in
OSGI environment.

Case:
The [ClassNotFoundException] is thrown when Objects#cloneModel or
Objects#cloneObject tries to clone objects that the class is not
resolveable by the Class#forName (used by ObjectInputStream) .

Possible solution:
<code fileName="wicket/util/lang/Objects.java">
package wicket.util.lang;

public abstract class Objects
{

...

private static final class ReplacedObjectInputStream extends ObjectInputStream
{

....

// Note:
// This overide is required  to resolve classess inside in different
bundle, i.e.
// The classess can be resolved by OSGI classresolver implementation
protected Class resolveClass(ObjectStreamClass desc)
throws IOException, ClassNotFoundException
{
   String className = desc.getName();
   Application application = Application.get();
   IApplicationSettings applicationSettings =
application.getApplicationSettings();
   IClassResolver classResolver = applicationSettings.getClassResolver();

   // TODO: How to deal with classResolver that throw RuntimeException?
   Class candidate = classResolver.resolveClass(className);
   if( candidate == null )
   {
       candidate = super.resolveClass( desc );
   }

   return candidate;
}
}

....
}
</code>

This modification does not break wicket testcases :)

Regards,
Edward Yakop


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Wicket-develop mailing list
Wicket-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to