You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@johnzon.apache.org by Romain Manni-Bucau <rm...@gmail.com> on 2015/07/23 01:43:39 UTC

jaxrs and exception handling

Hi

how should we handle exceptions having themself as root cause?

Simple solution is to detect the loop and skip the serialization that said
it can be valid as well - not sure somebody would do it with exception but
for other types it can.

Of course actual issue is to avoid Stackoverflow exception during
serialization.

Wdyt?

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

Re: jaxrs and exception handling

Posted by Romain Manni-Bucau <rm...@gmail.com>.
resolved it just ignoring cause and suppressed exception getters.

think it is ok for most cases + added a config for it.

I dont want to handle circular graph yet since it really needs a good API
to be usable (typically JPA case can need it but we cant just say "oh we
already saw this instance then ignore it").

Let me know if you think the fix is wrong.




Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-07-23 9:38 GMT-07:00 Romain Manni-Bucau <rm...@gmail.com>:

> created: https://issues.apache.org/jira/browse/JOHNZON-49
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github
> <https://github.com/rmannibucau> | LinkedIn
> <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>
> 2015-07-23 3:48 GMT-07:00 Romain Manni-Bucau <rm...@gmail.com>:
>
>>
>> Le 23 juil. 2015 09:30, "Hendrik Dev" <he...@gmail.com> a écrit :
>> >
>> > +1 for the simple solution (but it isn't it a very rare case that a
>> > exception has a self reference to it as root root cause?)
>>
>> It is not rare actually.
>>
>> I ll try to hack up something but for Throwable only which is not user
>> controlled most of the time. Object graph is so I guess cycles can be
>> considered desired.
>>
>> Wdyt?
>>
>> >
>> > On Thu, Jul 23, 2015 at 1:43 AM, Romain Manni-Bucau
>> > <rm...@gmail.com> wrote:
>> > > Hi
>> > >
>> > > how should we handle exceptions having themself as root cause?
>> > >
>> > > Simple solution is to detect the loop and skip the serialization that
>> said
>> > > it can be valid as well - not sure somebody would do it with
>> exception but
>> > > for other types it can.
>> > >
>> > > Of course actual issue is to avoid Stackoverflow exception during
>> > > serialization.
>> > >
>> > > Wdyt?
>> > >
>> > > Romain Manni-Bucau
>> > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>> > > <http://rmannibucau.wordpress.com> | Github <
>> https://github.com/rmannibucau> |
>> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
>> > > <http://www.tomitribe.com>
>> >
>> >
>> >
>> > --
>> > Hendrik Saly (salyh, hendrikdev22)
>> > @hendrikdev22
>> > PGP: 0x22D7F6EC
>>
>
>

Re: jaxrs and exception handling

Posted by Romain Manni-Bucau <rm...@gmail.com>.
created: https://issues.apache.org/jira/browse/JOHNZON-49


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-07-23 3:48 GMT-07:00 Romain Manni-Bucau <rm...@gmail.com>:

>
> Le 23 juil. 2015 09:30, "Hendrik Dev" <he...@gmail.com> a écrit :
> >
> > +1 for the simple solution (but it isn't it a very rare case that a
> > exception has a self reference to it as root root cause?)
>
> It is not rare actually.
>
> I ll try to hack up something but for Throwable only which is not user
> controlled most of the time. Object graph is so I guess cycles can be
> considered desired.
>
> Wdyt?
>
> >
> > On Thu, Jul 23, 2015 at 1:43 AM, Romain Manni-Bucau
> > <rm...@gmail.com> wrote:
> > > Hi
> > >
> > > how should we handle exceptions having themself as root cause?
> > >
> > > Simple solution is to detect the loop and skip the serialization that
> said
> > > it can be valid as well - not sure somebody would do it with exception
> but
> > > for other types it can.
> > >
> > > Of course actual issue is to avoid Stackoverflow exception during
> > > serialization.
> > >
> > > Wdyt?
> > >
> > > Romain Manni-Bucau
> > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > <http://www.tomitribe.com>
> >
> >
> >
> > --
> > Hendrik Saly (salyh, hendrikdev22)
> > @hendrikdev22
> > PGP: 0x22D7F6EC
>

Re: jaxrs and exception handling

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Le 23 juil. 2015 09:30, "Hendrik Dev" <he...@gmail.com> a écrit :
>
> +1 for the simple solution (but it isn't it a very rare case that a
> exception has a self reference to it as root root cause?)

It is not rare actually.

I ll try to hack up something but for Throwable only which is not user
controlled most of the time. Object graph is so I guess cycles can be
considered desired.

Wdyt?

>
> On Thu, Jul 23, 2015 at 1:43 AM, Romain Manni-Bucau
> <rm...@gmail.com> wrote:
> > Hi
> >
> > how should we handle exceptions having themself as root cause?
> >
> > Simple solution is to detect the loop and skip the serialization that
said
> > it can be valid as well - not sure somebody would do it with exception
but
> > for other types it can.
> >
> > Of course actual issue is to avoid Stackoverflow exception during
> > serialization.
> >
> > Wdyt?
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <http://rmannibucau.wordpress.com> | Github <
https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com>
>
>
>
> --
> Hendrik Saly (salyh, hendrikdev22)
> @hendrikdev22
> PGP: 0x22D7F6EC

Re: jaxrs and exception handling

Posted by Hendrik Dev <he...@gmail.com>.
+1 for the simple solution (but it isn't it a very rare case that a
exception has a self reference to it as root root cause?)

On Thu, Jul 23, 2015 at 1:43 AM, Romain Manni-Bucau
<rm...@gmail.com> wrote:
> Hi
>
> how should we handle exceptions having themself as root cause?
>
> Simple solution is to detect the loop and skip the serialization that said
> it can be valid as well - not sure somebody would do it with exception but
> for other types it can.
>
> Of course actual issue is to avoid Stackoverflow exception during
> serialization.
>
> Wdyt?
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>



-- 
Hendrik Saly (salyh, hendrikdev22)
@hendrikdev22
PGP: 0x22D7F6EC