Discussion:
The cause of the exception is lost with the implementation of TransactionRolledbackException#writeReplace
bwnyasse
2018-09-28 08:56:08 UTC
Permalink
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
JumpStart
2018-10-01 10:02:26 UTC
Permalink
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
Post by 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
/
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
Loading...