[ 
http://issues.ops4j.org/browse/PAXWICKET-25?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13869#action_13869
 ] 

David Leangen commented on PAXWICKET-25:
----------------------------------------

I don't know, this was a very long time ago. Will need to look into it again to 
be sure.

> Cannot deserialize proxy classes
> --------------------------------
>
>                 Key: PAXWICKET-25
>                 URL: http://issues.ops4j.org/browse/PAXWICKET-25
>             Project: Pax Wicket
>          Issue Type: Bug
>            Reporter: David Leangen
>             Fix For: 1.0.0.RELEASE
>
>
> Proxy classes are not being serialized, which means that they cannot be 
> deserialized.
> Upon deserialization by Wicket, an exception is thrown.
> Currently, this problem can be worked around by doing this:
> public class SomeClass
>    implements Serialziation
> {
>    private static final long serialVersionUID = 1L;
>    private transient Object someProxy;
>    private final InvocationHandler handler;
>    private final Class<?>[] proxyInterfaces;
>    public SomeClass( Object someProxyInstance )
>    {
>        someProxy = someProxyInstance;
>        final Class<?> someProxyClass = someProxy.getClass();
>        if( Proxy.isProxyClass( someProxyClass ) )
>        {
>            handler = Proxy.getInvocationHandler( someProxy );
>            proxyInterfaces = someProxyClass.getInterfaces();
>        }
>        else
>        {
>            handler = null;
>            proxyInterfaces = null;
>        }
>    }
>    private void writeObject( ObjectOutputStream out )
>        throws IOException
>    {
>        out.defaultWriteObject();
>    }
>    private void readObject( ObjectInputStream in )
>        throws IOException, ClassNotFoundException
>    {
>        in.defaultReadObject();
>        if( null != m_handler && null != proxyInterfaces )
>        {
>            someProxy =
>                (Object)Proxy.newProxyInstance(
>                        getClass().getClassLoader(),
>                        proxyInterfaces,
>                        handler );
>        }
>    }
> }
> However, this is a really bad solution. The only real solution is to allow 
> proxied classes to be properly serialized/deserialized like any other class.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.ops4j.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

_______________________________________________
general mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to