On 09/11/2013 04:57 AM, Nicolas Filotto wrote:
What you don't understand is the fact RequestLifecycle.end() has
not
been designed to throw any exception except IllegalStateException if
you check the signature of the method but this exception never occurs
in practice, if it occurs it means that
RequestLifecycle.begin/RequestLifecycle.end were not in a try/finally
block which should never be the case.
Ok I misspoke. RequestLifecycle.end() is not
throwing the exception but
the actual ComponentRequestLifecycle object (ChromatticManager in this
case) and the exception is returned in the map. But my point is still valid.
A REST component (or any component/service for that matter) should not
be responsible for errors that occur during a RequestLifecycle.end().
However I think it's a slightly larger issue as I can reproduce the same
scenario in the portal. For example I can add the byteman script
http://paste.fedoraproject.org/38733/37891033 and edit/save the
navigation and UI says the request was successful however the data was
not saved.
And before we have another "why don't you just save the session in the
component" discussion, I hope we can all see the larger/potential issue.
The question really is if it's a common enough scenario that is worth
addressing.
So knowing that you can either
1. Throw a RuntimeException but if you do that it would mean that you
did not implement properly the method
ComponentRequestLifecycle.endRequest as no exception should be
thrown from these methods.
2. You caught the exception inside your
method ComponentRequestLifecycle.endRequest, in that case we have
no way to know that it failed
The rest component sent a response code 200 because the code of your
rest component has been executed successfully which is true since the
failure occurred outside. It is your job to manage all the possible
failures inside your rest component to return the correct code and
error message according to the situation. Here is a good example
https://github.com/exodev/jcr/blob/master/exo.jcr.component.webdav/src/ma...,
this is our Webdav connector based on eXo WS as you can see we manage
ourself all the possible failures. It is what you are supposed to do.
Thanks for
the link but I know how to handled exceptions in my REST
component, or in general for that matter.
On Tue, Sep 10, 2013 at 8:47 PM, Nick Scavelli <nscavell(a)redhat.com
<mailto:nscavell@redhat.com>> wrote:
I think you are missing the point. If an exception is thrown from
RequestLifecycle.end() for whatever reason, the response is still
completed (flushed). The root cause of the exception is another
subject matter, which I think was a replication issue in EPP 5.2.
- Nick
On 09/10/2013 10:19 AM, Nicolas Filotto wrote:
What is the code of you Rest component and the stack trace ?