google / google/guice

Custom exception must implement isSerializable

Open
#497 4 comments 0 reactions 0 assignees View on GitHub
imported
Dominant language
Java
Stars
12.7k
Forks
1.7k
Avg merge
11m
Merged PRs (30d)
2

Description

_From [kospiotr](https://code.google.com/u/kospiotr/) on June 18, 2010 04:09:51_

In old style I have RPC service defined like this:

`@`RemoteServiceRelativePath("gwtservice")
public interface GWTService extends RemoteService {
    public String myMethod(String s) throws SampleException;
}

implementation of the service like this:

public class GWTServiceImpl extends RemoteServiceServlet implements GWTService {
    public String myMethod(String s) throws SampleException{
        throw new SampleException("sample");
    }
}

and my SampleException class look like this:

public class SampleException extends Exception{

    public SampleException() {
        super();
    }

    public SampleException(String msg) {
        super(msg);
    }
}

When I'm using Guice I need to implement also isSerializable or extend SerializableException from GWT lib, but since GWT 1.5, Exception implements Serializable and can be used in place of this class.

If I won't implement isSerializable I'm gettin exception:
com.google.gwt.user.client.rpc.SerializationException: Type 'org.testing.client.CustomNonSerializableException' was not assignable to 'com.google.gwt.user.client.rpc.IsSerializable' and did not have a custom field serializer.For security purposes, this type will not be serialized.: instance = org.testing.client.CustomNonSerializableException: Message of custom exception

I'm using GWT 2.0.3 with Guice implemented according this article: http://stuffthathappens.com/blog/2009/09/14/guice-with-gwt/

_Original issue: http://code.google.com/p/google-guice/issues/detail?id=497_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.