tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bwnyasse <risbonya...@gmail.com>
Subject The cause of the exception is lost with the implementation of TransactionRolledbackException#writeReplace
Date Fri, 28 Sep 2018 08:56:08 GMT
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

Mime
View raw message