Skip to content
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

Merged
merged 2 commits into from
Aug 21, 2013

Conversation

Chris-V
Copy link
Member

@Chris-V Chris-V commented Aug 15, 2013

}
}

@Override
public void undo(String cookieSentByRPC, Action<Result> action, Result result) throws ActionException,
ServiceException {
ServiceException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting?

@christiangoudreau
Copy link
Member

LGTM, verify format

@spg
Copy link
Member

spg commented Aug 19, 2013

LGTM

1 similar comment
@meriouma
Copy link
Member

LGTM

Chris-V pushed a commit that referenced this pull request Aug 21, 2013
Removed illegal call to Throwable#initCause
@Chris-V Chris-V merged commit 57d50ce into master Aug 21, 2013
@Chris-V Chris-V deleted the cv_fix_illegal_exception_state branch August 21, 2013 02:11
@kuhnroyal
Copy link
Contributor

I am running into this issue as well, how soon can we expect 1.0.2 to be released?

@kuhnroyal
Copy link
Contributor

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?

@christiangoudreau
Copy link
Member

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?

@christiangoudreau
Copy link
Member

Create a subclass exception by reflexion?

@kuhnroyal
Copy link
Contributor

How about sending the exception class and the message in the ActionException and rebuild the original exception on the client?

@kuhnroyal
Copy link
Contributor

Could probably use a generator for the rebuilding part?

@Chris-V
Copy link
Member Author

Chris-V commented Aug 26, 2013

I'm actually thinking a custom RPC serializer for the exceptions may do the trick: just ignore the fields responsible for the cause in Throwable and wrapping exceptions is no longer necessary.

Rebuilding the exception on the client is what RPC somehow does and I'd rather let them do it.

@kuhnroyal
Copy link
Contributor

Sounds good!

@christiangoudreau
Copy link
Member

+1

@kuhnroyal
Copy link
Contributor

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.

There is always a stacktrace attached to a throwable, with this patch it is just a different one, or am I wrong?

@christiangoudreau
Copy link
Member

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

@kuhnroyal
Copy link
Contributor

Right!
Am 27.08.2013 17:36 schrieb "christiangoudreau" [email protected]:

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


Reply to this email directly or view it on GitHubhttps://github.com//pull/312#issuecomment-23345816
.

@Chris-V
Copy link
Member Author

Chris-V commented Aug 27, 2013

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.

@christiangoudreau
Copy link
Member

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.

@kuhnroyal
Copy link
Contributor

I agree
Am 27.08.2013 17:51 schrieb "christiangoudreau" [email protected]:

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.


Reply to this email directly or view it on GitHubhttps://github.com//pull/312#issuecomment-23347117
.

@kuhnroyal
Copy link
Contributor

JavaDoc for Throwable.setStackTrace() is also interesting for this. You can probably kill the stacktrace with this.

@christiangoudreau
Copy link
Member

Uhm, I though that was also a protected method that cannot be called!

@christiangoudreau
Copy link
Member

Guys, we added this to a release! We need to get it right ASAP and do another release. @Chris-V @olafleur could you plan this in the schedule for early next week please?

@olafleur
Copy link
Member

Ok !

@branflake2267
Copy link
Contributor

Thanks for letting us know.

@kuhnroyal
Copy link
Contributor

Yes, we need to get this straightened out, I am having the same problem.
Any new ideas on how to tackle this?

@spg
Copy link
Member

spg commented Nov 13, 2013

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.: e.setStackTrace(new StackTraceElement[] {})) ?

@christiangoudreau
Copy link
Member

We want to remove it, but we need to log it.

@spg
Copy link
Member

spg commented Nov 15, 2013

@kuhnroyal I can see situations where one would want to subclass ActionException (since ActionException is thrown by action handlers and validators). However, is there some cases where one would want to subclass ServiceException?

As you can see in #340 , only ActionExceptions are rethrown as-is. ServiceException and RuntimeException are thrown in new instances, thus making it impossible for the GWT code to check if throwable instanceof MyCustomServiceException.

@kuhnroyal
Copy link
Contributor

I don't think so, at least from my point of view. ActionException subclasses is all I need.

@spg
Copy link
Member

spg commented Nov 15, 2013

Perfect, that was my assumption.

Chris-V pushed a commit that referenced this pull request Apr 4, 2014
Removed illegal call to Throwable#initCause
hpehl pushed a commit to hpehl/GWTP that referenced this pull request Dec 9, 2014
…state

Removed illegal call to Throwable#initCause


Former-commit-id: f0880e1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GWTP 1.0 java.lang.IllegalStateException when ActionValidator.isValid() returns false
7 participants