-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removed illegal call to Throwable#initCause #312
Conversation
} | ||
} | ||
|
||
@Override | ||
public void undo(String cookieSentByRPC, Action<Result> action, Result result) throws ActionException, | ||
ServiceException { | ||
ServiceException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting?
LGTM, verify format |
LGTM |
1 similar comment
LGTM |
Removed illegal call to Throwable#initCause
I am running into this issue as well, how soon can we expect 1.0.2 to be released? |
I don't see how I can use custom Exceptions with this? Any exception I throw is re-thrown as ServiceException or ActionException. Previously subclassed Action/Serviceexception could be thrown to the client. This is a breaking change and maybe unwanted? |
Good point, but for security issues, the stack trace need to be removed and we can't simply removed it form the exception that is thrown. Do you have a suggestion? |
Create a subclass exception by reflexion? |
How about sending the exception class and the message in the ActionException and rebuild the original exception on the client? |
Could probably use a generator for the rebuilding part? |
I'm actually thinking a custom RPC serializer for the exceptions may do the trick: just ignore the fields responsible for the cause in Rebuilding the exception on the client is what RPC somehow does and I'd rather let them do it. |
Sounds good! |
+1 |
There is always a stacktrace attached to a throwable, with this patch it is just a different one, or am I wrong? |
You're not wrong, but it is a safe stacktrace has the source stack trace is removed and the only internal that is exposed is the one from our abstract dispatcher which is open source anyway |
Right!
|
By stacktrace I mean the cause hierarchy as well. The stacktrace being visible on the client is what Christian just mentioned. Anyways I did a couple tests and it seems the cause is never serialized by GWT-RPC. I found this post http://stackoverflow.com/questions/12448061/why-doesnt-gwt-serialize-an-exceptionss-cause-chain and it seems up to date enough (SerializabilityUtil#589). So maybe we got it all wrong here and the whole thing is not necessary. |
That only says that if a Throwable isn't GWT compatible, it will get ignored. That doesn't mean that the ones that you're building aren't. We should make some more test just to make sure, in any case, we should preserve the Throwable instead of hiding it behind service exception. |
I agree
|
JavaDoc for Throwable.setStackTrace() is also interesting for this. You can probably kill the stacktrace with this. |
Uhm, I though that was also a protected method that cannot be called! |
Ok ! |
Thanks for letting us know. |
Yes, we need to get this straightened out, I am having the same problem. |
I've started writing a patch to fix things up. I have a question though: do we want to completely remove the stacktrace from the thrown exception (i.e.: |
We want to remove it, but we need to log it. |
@kuhnroyal I can see situations where one would want to subclass As you can see in #340 , only |
I don't think so, at least from my point of view. ActionException subclasses is all I need. |
Perfect, that was my assumption. |
Removed illegal call to Throwable#initCause
…state Removed illegal call to Throwable#initCause Former-commit-id: f0880e1
@christiangoudreau @meriouma @spg
Fixes #293