The cause of the exception is lost with the implementation of TransactionRolledbackException#writeReplace

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

The cause of the exception is lost with the implementation of TransactionRolledbackException#writeReplace

bwnyasse
We are migrating from OpenEjb 4.5.0 to OpenEjb 7.x and We are facing a
regression in a test.

The test is a simple scenario in which we store an entity and we expect to
have an exception like "MyExampleStoreException".

We used to loop into the retrieving throwable exception to check if our
exception is present like the following :
/
                        Throwable cause = e.getCause();
                        while (cause.getCause() != null)
                        {
                                cause = cause.getCause();
                        }
                        Assert.assertTrue(cause instanceof MyExampleStoreException);/

The test is working great with OpenEjb 4.5.0. But We are noticed that this
commit
<https://github.com/apache/tomee/commit/a2daab8dda96135f1c4e0b50ff4c3049e67703f5#diff-024ace03b3f51b30b254487b1942b692>  
introduce the method #writeReplace , so now we will have a*
javax.transaction.TransactionRolledbackException* but no way to retrieve the
original cause.

We are wondering if it is ok to not be able to retrieve the original cause
of the TransactionRolledbackException ? For now , we can check in the
message like this

                     
/Assert.assertTrue(cause.getMessage().contains(MyExampleStoreException.class.getCanonicalName()));/


Any suggestion ?


thanks
Boris-Wilfried






--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html
Reply | Threaded
Open this post in threaded view
|

Re: The cause of the exception is lost with the implementation of TransactionRolledbackException#writeReplace

JumpStart
Yes, it sucks. I cannot use TOMEE in production for that very reason. See https://issues.apache.org/jira/browse/TOMEE-172 <https://issues.apache.org/jira/browse/TOMEE-172> .

Geoff

> On 28 Sep 2018, at 4:56 pm, bwnyasse <[hidden email]> wrote:
>
> We are migrating from OpenEjb 4.5.0 to OpenEjb 7.x and We are facing a
> regression in a test.
>
> The test is a simple scenario in which we store an entity and we expect to
> have an exception like "MyExampleStoreException".
>
> We used to loop into the retrieving throwable exception to check if our
> exception is present like the following :
> /
> Throwable cause = e.getCause();
> while (cause.getCause() != null)
> {
> cause = cause.getCause();
> }
> Assert.assertTrue(cause instanceof MyExampleStoreException);/
>
> The test is working great with OpenEjb 4.5.0. But We are noticed that this
> commit
> <https://github.com/apache/tomee/commit/a2daab8dda96135f1c4e0b50ff4c3049e67703f5#diff-024ace03b3f51b30b254487b1942b692>  
> introduce the method #writeReplace , so now we will have a*
> javax.transaction.TransactionRolledbackException* but no way to retrieve the
> original cause.
>
> We are wondering if it is ok to not be able to retrieve the original cause
> of the TransactionRolledbackException ? For now , we can check in the
> message like this
>
>
> /Assert.assertTrue(cause.getMessage().contains(MyExampleStoreException.class.getCanonicalName()));/
>
>
> Any suggestion ?
>
>
> thanks
> Boris-Wilfried
>
>
>
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html