[jboss-svn-commits] JBL Code SVN: r26428 - in labs/jbosstm/trunk/ArjunaJTS: jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/jca and 7 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri May 8 05:41:28 EDT 2009


Author: jhalliday
Date: 2009-05-08 05:41:28 -0400 (Fri, 08 May 2009)
New Revision: 26428

Modified:
   labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/BaseTransaction.java
   labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionImple.java
   labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionManagerImple.java
   labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/jca/XATerminatorImple.java
   labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/subordinate/TransactionImple.java
   labs/jbosstm/trunk/ArjunaJTS/jtax/tests/classes/com/hp/mwtests/ts/jta/jts/lastresource/LastOnePhaseResource.java
   labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/utils/Utility.java
   labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/ORBInfo.java
   labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/opPropertyManager.java
   labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/oa/core/OA.java
   labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/orb/core/ORB.java
Log:
Improved exception chaining in ArjunaJTS. JBTM-547


Modified: labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/BaseTransaction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/BaseTransaction.java	2009-05-08 08:59:57 UTC (rev 26427)
+++ labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/BaseTransaction.java	2009-05-08 09:41:28 UTC (rev 26428)
@@ -1,8 +1,8 @@
 /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. 
- * See the copyright.txt in the distribution for a full listing 
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
  * of individual contributors.
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
@@ -14,7 +14,7 @@
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -73,11 +73,11 @@
 
 /**
  * Some common methods for UserTransaction and TransactionManager.
- * 
+ *
  * @author Mark Little (mark_little at hp.com)
  * @version $Id: BaseTransaction.java 2342 2006-03-30 13:06:17Z  $
  * @since JTS 2.1.
- * 
+ *
  * @message com.arjuna.ats.internal.jta.transaction.jts.notx
  *          [com.arjuna.ats.internal.jta.transaction.jts.notx] - no transaction!
  * @message com.arjuna.ats.internal.jta.transaction.jts.invalidtx
@@ -115,11 +115,15 @@
 			}
 			catch (IllegalStateException e1)
 			{
-				throw new NotSupportedException(e1.getMessage());
+                NotSupportedException notSupportedException = new NotSupportedException(e1.getMessage());
+                notSupportedException.initCause(e1);
+				throw notSupportedException;
 			}
 			catch (org.omg.CORBA.SystemException e2)
 			{
-				throw new javax.transaction.SystemException(e2.toString());
+                javax.transaction.SystemException systemException = new javax.transaction.SystemException(e2.toString());
+                systemException.initCause(e2);
+				throw systemException;
 			}
 		}
 
@@ -131,11 +135,15 @@
 		{
 			// shouldn't happen if we get here from the previous checks!
 
-			throw new NotSupportedException(e3.getMessage());
+            NotSupportedException notSupportedException = new NotSupportedException(e3.getMessage());
+            notSupportedException.initCause(e3);
+            throw notSupportedException;
 		}
 		catch (org.omg.CORBA.SystemException e4)
 		{
-			throw new javax.transaction.SystemException(e4.toString());
+            javax.transaction.SystemException systemException = new javax.transaction.SystemException(e4.toString());
+            systemException.initCause(e4);
+            throw systemException;
 		}
 	}
 
@@ -171,7 +179,7 @@
 			throw new IllegalStateException(
 					"BaseTransaction.commit - "
 							+ jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.notxe")
-							+ ex);
+							+ ex, ex);
 		}
 
 		checkTransactionState();
@@ -193,7 +201,7 @@
 		}
 		catch (NullPointerException ex)
 		{
-			throw new IllegalStateException();
+			throw new IllegalStateException(ex);
 		}
 
 		checkTransactionState();
@@ -216,7 +224,7 @@
 		catch (NullPointerException ex)
 		{
 			throw new IllegalStateException(
-					jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.nosuchtx"));
+					jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.nosuchtx"), ex);
 		}
 	}
 
@@ -239,7 +247,9 @@
 		}
 		catch (Exception e)
 		{
-			throw new javax.transaction.SystemException(e.toString());
+            javax.transaction.SystemException systemException = new javax.transaction.SystemException(e.toString());
+            systemException.initCause(e);
+            throw systemException;
 		}
 	}
 
@@ -252,7 +262,9 @@
 		}
 		catch (Exception e)
 		{
-			throw new javax.transaction.SystemException(e.toString());
+            javax.transaction.SystemException systemException = new javax.transaction.SystemException(e.toString());
+            systemException.initCause(e);
+            throw systemException;
 		}
 	}
 
@@ -264,7 +276,9 @@
 		}
 		catch (Exception e)
 		{
-			throw new javax.transaction.SystemException(e.toString());
+            javax.transaction.SystemException systemException = new javax.transaction.SystemException(e.toString());
+            systemException.initCause(e);
+            throw systemException;
 		}
 	}
 
@@ -275,7 +289,7 @@
 	/**
 	 * Called when we want to make sure this thread does not already have a
 	 * transaction associated with it.
-	 * 
+	 *
 	 * @message com.arjuna.ats.internal.jta.transaction.jts.alreadyassociated
 	 *          [com.arjuna.ats.internal.jta.transaction.jts.alreadyassociated]
 	 *          thread is already associated with a transaction and
@@ -313,7 +327,9 @@
 		}
 		catch (org.omg.CORBA.SystemException e1)
 		{
-			throw new javax.transaction.SystemException(e1.toString());
+            javax.transaction.SystemException systemException = new javax.transaction.SystemException(e1.toString());
+            systemException.initCause(e1);
+            throw systemException;
 		}
 		catch (org.omg.CosTransactions.Unavailable e2)
 		{

Modified: labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionImple.java	2009-05-08 08:59:57 UTC (rev 26427)
+++ labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionImple.java	2009-05-08 09:41:28 UTC (rev 26428)
@@ -73,6 +73,7 @@
 import java.util.*;
 
 import javax.transaction.RollbackException;
+import javax.transaction.HeuristicMixedException;
 import java.lang.SecurityException;
 import java.lang.IllegalStateException;
 import org.omg.CosTransactions.SubtransactionsUnavailable;
@@ -270,39 +271,52 @@
 			}
 			catch (org.omg.CosTransactions.WrongTransaction wt)
 			{
-				throw new InactiveTransactionException(
+                InactiveTransactionException inactiveTransactionException = new InactiveTransactionException(
 						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.wrongstatetx"));
+                inactiveTransactionException.initCause(wt);
+                throw inactiveTransactionException;
 			}
 			catch (org.omg.CosTransactions.NoTransaction e1)
 			{
-				throw new IllegalStateException(
-						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.notx"));
+                IllegalStateException illegalStateException = new IllegalStateException(jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.notx"));
+                illegalStateException.initCause(e1);
+                throw illegalStateException;
 			}
 			catch (org.omg.CosTransactions.HeuristicMixed e2)
 			{
-				throw new javax.transaction.HeuristicMixedException();
+                HeuristicMixedException heuristicMixedException = new javax.transaction.HeuristicMixedException();
+                heuristicMixedException.initCause(e2);
+                throw heuristicMixedException;
 			}
 			catch (org.omg.CosTransactions.HeuristicHazard e3)
 			{
-				throw new javax.transaction.HeuristicMixedException();
+                HeuristicMixedException heuristicMixedException = new javax.transaction.HeuristicMixedException();
+                heuristicMixedException.initCause(e3);
+                throw heuristicMixedException;
 			}
 			catch (TRANSACTION_ROLLEDBACK e4)
 			{
-				throw new RollbackException(e4.toString());
+                RollbackException rollbackException = new RollbackException(e4.toString());
+                rollbackException.initCause(e4);
+                throw e4;
 			}
 			catch (org.omg.CORBA.NO_PERMISSION e5)
 			{
-				throw new SecurityException();
+				throw new SecurityException(e5);
 			}
 			catch (INVALID_TRANSACTION e6)
 			{
-				throw new InactiveTransactionException(
+				InactiveTransactionException inactiveTransactionException = new InactiveTransactionException(
 						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.invalidtx2"));
+                inactiveTransactionException.initCause(e6);
+                throw inactiveTransactionException;
 			}
 			catch (org.omg.CORBA.SystemException e7)
 			{
-				throw new javax.transaction.SystemException();
-			}
+                javax.transaction.SystemException systemException = new javax.transaction.SystemException(e7.toString());
+                systemException.initCause(e7);
+        		throw systemException;
+            }
 			finally
 			{
 				TransactionImple.removeTransaction(this);
@@ -355,26 +369,32 @@
 			}
 			catch (org.omg.CosTransactions.WrongTransaction e1)
 			{
-				throw new InactiveTransactionException(
+                InactiveTransactionException inactiveTransactionException =new InactiveTransactionException(
 						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.wrongstatetx"));
+                inactiveTransactionException.initCause(e1);
+                throw inactiveTransactionException;
 			}
 			catch (org.omg.CORBA.NO_PERMISSION e2)
 			{
-				throw new SecurityException();
+				throw new SecurityException(e2);
 			}
 			catch (INVALID_TRANSACTION e3)
 			{
-				throw new InactiveTransactionException(
+                InactiveTransactionException inactiveTransactionException = new InactiveTransactionException(
 						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.invalidtx2"));
+                inactiveTransactionException.initCause(e3);
+                throw inactiveTransactionException;
 			}
 			catch (NoTransaction e4)
 			{
 				throw new IllegalStateException(
-						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.notx"));
+						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.notx"), e4);
 			}
 			catch (org.omg.CORBA.SystemException e5)
 			{
-				throw new javax.transaction.SystemException();
+                javax.transaction.SystemException systemException = new javax.transaction.SystemException(e5.toString());
+                systemException.initCause(e5);
+        		throw systemException;
 			}
 			finally
 			{
@@ -411,13 +431,15 @@
 			}
 			catch (org.omg.CosTransactions.NoTransaction e3)
 			{
-				throw new IllegalStateException(
-						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.notx"));
+                throw new IllegalStateException(
+						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.notx"), e3);
 			}
 			catch (org.omg.CORBA.SystemException e4)
 			{
-				throw new javax.transaction.SystemException();
-			}
+                javax.transaction.SystemException systemException = new javax.transaction.SystemException(e4.toString());
+                systemException.initCause(e4);
+		        throw systemException;
+            }
 		}
 		else
 			throw new IllegalStateException(
@@ -441,7 +463,9 @@
 			}
 			catch (org.omg.CORBA.SystemException e2)
 			{
-				throw new javax.transaction.SystemException();
+                javax.transaction.SystemException systemException = new javax.transaction.SystemException(e2.toString());
+                systemException.initCause(e2);
+		        throw systemException;
 			}
 		}
 
@@ -490,26 +514,30 @@
 			}
 			catch (TRANSACTION_ROLLEDBACK e2)
 			{
-				throw new javax.transaction.RollbackException(e2.toString());
+                RollbackException rollbackException = new javax.transaction.RollbackException(e2.toString());
+                rollbackException.initCause(e2);
+                throw rollbackException;
 			}
 			catch (org.omg.CosTransactions.Inactive e3)
 			{
 				throw new IllegalStateException(
-						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.inactivetx"));
+						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.inactivetx"), e3);
 			}
 			catch (org.omg.CosTransactions.SynchronizationUnavailable e4)
 			{
 				throw new IllegalStateException(
-						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.syncerror"));
+						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.syncerror"), e4);
 			}
 			catch (INVALID_TRANSACTION e5)
 			{
 				throw new IllegalStateException(
-						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.invalidtx2"));
+						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.invalidtx2"), e5);
 			}
 			catch (org.omg.CORBA.SystemException e6)
 			{
-				throw new javax.transaction.SystemException();
+                javax.transaction.SystemException systemException = new javax.transaction.SystemException(e6.toString());
+                systemException.initCause(e6);
+		        throw systemException;
 			}
 		}
 		else
@@ -1385,20 +1413,24 @@
 			catch (org.omg.CosTransactions.WrongTransaction wt)
 			{
 				throw new IllegalStateException(
-						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.wrongstatetx"));
+						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.wrongstatetx"), wt);
 			}
 			catch (org.omg.CosTransactions.NoTransaction e1)
 			{
 				throw new IllegalStateException(
-						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.notx"));
+						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.notx"), e1);
 			}
 			catch (org.omg.CosTransactions.HeuristicMixed e2)
 			{
-				throw new javax.transaction.HeuristicMixedException();
+                HeuristicMixedException heuristicMixedException = new javax.transaction.HeuristicMixedException();
+                heuristicMixedException.initCause(e2);
+                throw heuristicMixedException;
 			}
 			catch (org.omg.CosTransactions.HeuristicHazard e3)
 			{
-				throw new javax.transaction.HeuristicMixedException();
+                HeuristicMixedException heuristicMixedException = new javax.transaction.HeuristicMixedException();
+                heuristicMixedException.initCause(e3);
+                throw heuristicMixedException;
 			}
 			catch (TRANSACTION_ROLLEDBACK e4)
 			{
@@ -1411,7 +1443,7 @@
 			}
 			catch (org.omg.CORBA.NO_PERMISSION e5)
 			{
-				throw new SecurityException();
+				throw new SecurityException(e5);
 			}
 			catch (INVALID_TRANSACTION e6)
 			{
@@ -1425,7 +1457,9 @@
 			}
 			catch (org.omg.CORBA.SystemException e7)
 			{
-				throw new InvalidTerminationStateException();
+                InvalidTerminationStateException invalidTerminationStateException = new InvalidTerminationStateException();
+                invalidTerminationStateException.initCause(e7);
+                throw invalidTerminationStateException;
 			}
 			finally
 			{
@@ -1455,25 +1489,27 @@
 			catch (org.omg.CosTransactions.WrongTransaction e1)
 			{
 				throw new IllegalStateException(
-						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.wrongstatetx"));
+						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.wrongstatetx"), e1);
 			}
 			catch (org.omg.CORBA.NO_PERMISSION e2)
 			{
-				throw new SecurityException();
+				throw new SecurityException(e2);
 			}
 			catch (INVALID_TRANSACTION e3)
 			{
 				throw new IllegalStateException(
-						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.invalidtx2"));
+						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.invalidtx2"), e3);
 			}
 			catch (NoTransaction e4)
 			{
 				throw new IllegalStateException(
-						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.notx"));
+						jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.notx"), e4);
 			}
 			catch (org.omg.CORBA.SystemException e5)
 			{
-				throw new javax.transaction.SystemException();
+                javax.transaction.SystemException systemException = new javax.transaction.SystemException(e5.toString());
+                systemException.initCause(e5);
+		        throw systemException;
 			}
 			finally
 			{
@@ -1819,8 +1855,10 @@
 				}
 				catch (org.omg.CORBA.SystemException e3)
 				{
-					throw new javax.transaction.SystemException();
-				}
+                    javax.transaction.SystemException systemException = new javax.transaction.SystemException(e3.toString());
+                    systemException.initCause(e3);
+		            throw systemException;
+                }
 			}
 		}
 		catch (Exception ex)

Modified: labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionManagerImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionManagerImple.java	2009-05-08 08:59:57 UTC (rev 26427)
+++ labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionManagerImple.java	2009-05-08 09:41:28 UTC (rev 26428)
@@ -79,7 +79,9 @@
 		}
 		catch (Exception e)
 		{
-			throw new javax.transaction.SystemException();
+            javax.transaction.SystemException systemException = new javax.transaction.SystemException(e.toString());
+            systemException.initCause(e);
+		    throw systemException;
 		}
 	}
 
@@ -103,8 +105,10 @@
 		}
 		catch (Exception e)
 		{
-			throw new javax.transaction.SystemException();
-		}
+            javax.transaction.SystemException systemException = new javax.transaction.SystemException(e.toString());
+            systemException.initCause(e);
+            throw systemException;
+        }
 	}
 
 	/**
@@ -142,11 +146,15 @@
 	        }
 	        catch (org.omg.CosTransactions.InvalidControl e1)
 	        {
-	            throw new InvalidTransactionException();
+                InvalidTransactionException invalidTransactionException = new InvalidTransactionException();
+                invalidTransactionException.initCause(e1);
+                throw invalidTransactionException;
 	        }
 	        catch (org.omg.CORBA.SystemException e2)
 	        {
-	            throw new javax.transaction.SystemException();
+                javax.transaction.SystemException systemException = new javax.transaction.SystemException(e2.toString());
+                systemException.initCause(e2);
+                throw systemException;
 	        }
 	    }
 	    else

Modified: labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/jca/XATerminatorImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/jca/XATerminatorImple.java	2009-05-08 08:59:57 UTC (rev 26427)
+++ labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/jca/XATerminatorImple.java	2009-05-08 09:41:28 UTC (rev 26428)
@@ -98,27 +98,37 @@
 		}
 		catch (final HeuristicCommitException ex)
 		{
-		    throw new XAException(XAException.XA_HEURCOM);
+            XAException xaException = new XAException(XAException.XA_HEURCOM);
+            xaException.initCause(ex);
+            throw xaException;
 		}
 		catch (HeuristicRollbackException ex)
 		{
-			throw new XAException(XAException.XA_HEURRB);
+            XAException xaException = new XAException(XAException.XA_HEURRB);
+            xaException.initCause(ex);
+            throw xaException;
 		}
 		catch (HeuristicMixedException ex)
 		{
-			throw new XAException(XAException.XA_HEURMIX);
+            XAException xaException = new XAException(XAException.XA_HEURMIX);
+            xaException.initCause(ex);
+            throw xaException;
 		}
 		catch (final IllegalStateException ex)
 		{
-	            SubordinationManager.getTransactionImporter().removeImportedTransaction(xid);
-	                  
-		    throw new XAException(XAException.XAER_NOTA);
+	        SubordinationManager.getTransactionImporter().removeImportedTransaction(xid);
+
+            XAException xaException = new XAException(XAException.XAER_NOTA);
+            xaException.initCause(ex);
+            throw xaException;
 		}
 		catch (SystemException ex)
 		{
 			SubordinationManager.getTransactionImporter().removeImportedTransaction(xid);
 
-			throw new XAException(XAException.XAER_RMERR);
+            XAException xaException = new XAException(XAException.XAER_RMERR);
+            xaException.initCause(ex);
+            throw xaException;
 		}
 	}
 
@@ -135,7 +145,9 @@
 		}
 		catch (Exception ex)
 		{
-			throw new XAException(XAException.XAER_RMERR);
+            XAException xaException = new XAException(XAException.XAER_RMERR);
+            xaException.initCause(ex);
+            throw xaException;
 		}
 		finally
 		{
@@ -167,7 +179,7 @@
 			    {
 			        // if we failed to prepare then rollback should not fail!
 			    }
-			    
+
 				SubordinationManager.getTransactionImporter().removeImportedTransaction(xid);
 
 				throw new XAException(XAException.XA_RBROLLBACK);
@@ -318,27 +330,37 @@
 		}
 		catch (HeuristicCommitException ex)
 		{
-			throw new XAException(XAException.XA_HEURCOM);
+            XAException xaException = new XAException(XAException.XA_HEURCOM);
+            xaException.initCause(ex);
+            throw xaException;
 		}
-		catch (final HeuristicRollbackException exx)
+		catch (final HeuristicRollbackException ex)
 		{
-		    throw new XAException(XAException.XA_HEURRB);
+		    XAException xaException = new XAException(XAException.XA_HEURRB);
+            xaException.initCause(ex);
+            throw xaException;
 		}
 		catch (HeuristicMixedException ex)
 		{
-			throw new XAException(XAException.XA_HEURMIX);
+			XAException xaException = new XAException(XAException.XA_HEURMIX);
+            xaException.initCause(ex);
+            throw xaException;
 		}
 		catch (final IllegalStateException ex)
 		{
 		    SubordinationManager.getTransactionImporter().removeImportedTransaction(xid);
-		    
-		    throw new XAException(XAException.XAER_NOTA);
+
+		    XAException xaException = new XAException(XAException.XAER_NOTA);
+            xaException.initCause(ex);
+            throw xaException;
 		}
 		catch (SystemException ex)
 		{
 			SubordinationManager.getTransactionImporter().removeImportedTransaction(xid);
 
-			throw new XAException(XAException.XAER_RMERR);
+			XAException xaException = new XAException(XAException.XAER_RMERR);
+            xaException.initCause(ex);
+            throw xaException;
 		}
 	}
 

Modified: labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/subordinate/TransactionImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/subordinate/TransactionImple.java	2009-05-08 08:59:57 UTC (rev 26427)
+++ labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/subordinate/TransactionImple.java	2009-05-08 09:41:28 UTC (rev 26428)
@@ -221,9 +221,11 @@
                 }
                 catch (ClassCastException ex)
                 {
-                        ex.printStackTrace();
+                    ex.printStackTrace();
 
-                        throw new UnexpectedConditionException(ex.toString());
+                    UnexpectedConditionException unexpectedConditionException = new UnexpectedConditionException(ex.toString());
+                    unexpectedConditionException.initCause(ex);
+                    throw unexpectedConditionException;
                 }
                 finally
                 {
@@ -282,9 +284,11 @@
                 }
                 catch (ClassCastException ex)
                 {
-                        ex.printStackTrace();
+                    ex.printStackTrace();
 
-                        throw new UnexpectedConditionException(ex.toString());
+                    UnexpectedConditionException unexpectedConditionException = new UnexpectedConditionException(ex.toString());
+                    unexpectedConditionException.initCause(ex);
+                    throw unexpectedConditionException;
                 }
                 finally
                 {
@@ -345,7 +349,7 @@
                 {
                         ex.printStackTrace();
 
-                        throw new IllegalStateException();
+                        throw new IllegalStateException(ex);
                 }
         }
 
@@ -368,7 +372,7 @@
                 {
                         ex.printStackTrace();
 
-                        throw new IllegalStateException();
+                        throw new IllegalStateException(ex);
                 }
         }
 

Modified: labs/jbosstm/trunk/ArjunaJTS/jtax/tests/classes/com/hp/mwtests/ts/jta/jts/lastresource/LastOnePhaseResource.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jtax/tests/classes/com/hp/mwtests/ts/jta/jts/lastresource/LastOnePhaseResource.java	2009-05-08 08:59:57 UTC (rev 26427)
+++ labs/jbosstm/trunk/ArjunaJTS/jtax/tests/classes/com/hp/mwtests/ts/jta/jts/lastresource/LastOnePhaseResource.java	2009-05-08 09:41:28 UTC (rev 26428)
@@ -1,20 +1,20 @@
 /*
  * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors 
- * as indicated by the @author tags. 
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
  * See the copyright.txt in the distribution for a
- * full listing of individual contributors. 
+ * full listing of individual contributors.
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
  * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A 
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
  * You should have received a copy of the GNU Lesser General Public License,
  * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -31,25 +31,29 @@
 public class LastOnePhaseResource implements XAResource, Serializable, LastResourceCommitOptimisation
 {
     private static final long serialVersionUID = -2677829642809706893L ;
-    
+
     public static final int INITIAL = 0 ;
     public static final int COMMIT = 1 ;
     public static final int ROLLBACK = 2 ;
-    
+
     private int status = INITIAL ;
-    
+
     public int prepare(final Xid xid)
         throws XAException
     {
-        throw new XAException("Prepare called on LastOnePhaseResource") ;
+        XAException xaException = new XAException("Prepare called on LastOnePhaseResource");
+        xaException.errorCode = XAException.XAER_PROTO;
+        throw xaException;
     }
-    
+
     public void commit(final Xid xid, final boolean onePhaseCommit)
         throws XAException
     {
         if (!onePhaseCommit)
         {
-            throw new XAException("commit called with onePhaseCommit false") ;
+            XAException xaException = new XAException("commit called with onePhaseCommit false");
+            xaException.errorCode = XAException.XAER_PROTO;
+            throw xaException;
         }
         status = COMMIT ;
     }
@@ -59,7 +63,7 @@
     {
         status = ROLLBACK ;
     }
-    
+
     public int getStatus()
     {
         return status ;

Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/utils/Utility.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/utils/Utility.java	2009-05-08 08:59:57 UTC (rev 26427)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/utils/Utility.java	2009-05-08 09:41:28 UTC (rev 26428)
@@ -1,8 +1,8 @@
 /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. 
- * See the copyright.txt in the distribution for a full listing 
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
  * of individual contributors.
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
@@ -14,7 +14,7 @@
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -24,7 +24,7 @@
  * Hewlett-Packard Arjuna Labs,
  * Newcastle upon Tyne,
  * Tyne and Wear,
- * UK.  
+ * UK.
  *
  * $Id: Utility.java 2342 2006-03-30 13:06:17Z  $
  */
@@ -65,12 +65,12 @@
 
 public class Utility
 {
- 
+
     public static String getHierarchy (PropagationContext ctx)
     {
 	int depth = ((ctx.parents != null) ? ctx.parents.length : 0);
 	String hier = "PropagationContext:";
-    
+
 	for (int i = depth -1; i >= 0; i--)
 	{
 	    if (ctx.parents[i] != null)
@@ -104,7 +104,7 @@
     public static PrintWriter printStatus (PrintWriter strm, org.omg.CosTransactions.Status res)
     {
 	strm.print(stringStatus(res));
-	
+
 	return strm;
     }
 
@@ -150,7 +150,7 @@
     {
 	return XATxConverter.getXid(uid, branch, ArjunaTransactionImple.interpositionType());
     }
-    
+
     public static com.arjuna.ats.arjuna.xa.XID getXid (org.omg.CosTransactions.Control cont, boolean branch) throws IllegalStateException
     {
 	if (cont == null)
@@ -176,7 +176,7 @@
 	    }
 	    catch (Exception e)
 	    {
-		throw new IllegalStateException();
+		throw new IllegalStateException(e);
 	    }
 	}
     }
@@ -216,29 +216,29 @@
     {
 	return ((theUid != null) ? uidToOtid(theUid.stringForm()) : null);
     }
-    
+
     public static final org.omg.CosTransactions.otid_t uidToOtid (String theUid)
     {
 	if (theUid == null)
 	    return null;
-	
+
 	otid_t otid = new otid_t();
 	byte[] b = theUid.getBytes();
 	byte[] nodeName = TxControl.getXANodeName();
-	
+
 	otid.tid = new byte[b.length+nodeName.length+2];
 	otid.bqual_length = b.length+nodeName.length+2;
 
 	System.arraycopy(nodeName, 0, otid.tid, 0, nodeName.length);
-	
+
 	otid.tid[nodeName.length] = XATxConverter.NODE_SEPARATOR;
-	
+
 	System.arraycopy(b, 0, otid.tid, nodeName.length+1, b.length);
 
 	otid.tid[otid.bqual_length-1] = (byte) '\0';
 
 	b = null;
-	
+
 	return otid;
     }
 
@@ -248,13 +248,13 @@
      * the transaction either retransmits it or the application asks
      * for it (e.g., via the PropagationContext).
      */
-    
+
     public static final Uid otidToUid (org.omg.CosTransactions.otid_t otid)
     {
 	if (otid.bqual_length > 0)
 	{
 	    int nodeNameIndex = 0;
-	    
+
 	    for (int i = 0; i < otid.bqual_length; i++)
 	    {
 		if (otid.tid[i] == XATxConverter.NODE_SEPARATOR)

Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/ORBInfo.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/ORBInfo.java	2009-05-08 08:59:57 UTC (rev 26427)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/ORBInfo.java	2009-05-08 09:41:28 UTC (rev 26428)
@@ -1,8 +1,8 @@
 /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. 
- * See the copyright.txt in the distribution for a full listing 
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
  * of individual contributors.
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
@@ -14,7 +14,7 @@
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -203,7 +203,10 @@
 				opLogger.loggerI18N.fatal( "com.arjuna.orbportability.ORBInfo.unsupportedorb" );
 				}
 
-				throw new ExceptionInInitializerError( opLogger.logMesg.getString("com.arjuna.orbportability.ORBInfo.unsupportedorb") );
+                ExceptionInInitializerError exceptionInInitializerError =
+                        new ExceptionInInitializerError( opLogger.logMesg.getString("com.arjuna.orbportability.ORBInfo.unsupportedorb"));
+                exceptionInInitializerError.initCause(joe);
+                throw exceptionInInitializerError;
 			}
 		}
     	    }
@@ -226,8 +229,11 @@
                                 new Object[] { e } );
             }
 
-            throw new ExceptionInInitializerError( MessageFormat.format(opLogger.logMesg.getString("com.arjuna.orbportability.ORBInfo.creationfailed"),
-                                                                        new Object[] { e } ) );
+        ExceptionInInitializerError exceptionInInitializerError = new ExceptionInInitializerError(
+                MessageFormat.format(opLogger.logMesg.getString("com.arjuna.orbportability.ORBInfo.creationfailed"),
+                                                                        new Object[] { e } ));
+        exceptionInInitializerError.initCause(e);
+        throw exceptionInInitializerError;
 	}
     }
 

Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/opPropertyManager.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/opPropertyManager.java	2009-05-08 08:59:57 UTC (rev 26427)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/opPropertyManager.java	2009-05-08 09:41:28 UTC (rev 26428)
@@ -1,8 +1,8 @@
 /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. 
- * See the copyright.txt in the distribution for a full listing 
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
  * of individual contributors.
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
@@ -14,7 +14,7 @@
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -67,7 +67,9 @@
         }
         catch (Exception e)
         {
-            throw new ExceptionInInitializerError(e.toString());
+            ExceptionInInitializerError exceptionInInitializerError = new ExceptionInInitializerError(e.toString());
+            exceptionInInitializerError.initCause(e);
+            throw exceptionInInitializerError;
         }
     }
 }

Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/oa/core/OA.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/oa/core/OA.java	2009-05-08 08:59:57 UTC (rev 26427)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/oa/core/OA.java	2009-05-08 09:41:28 UTC (rev 26428)
@@ -1,8 +1,8 @@
 /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. 
- * See the copyright.txt in the distribution for a full listing 
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
  * of individual contributors.
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
@@ -14,7 +14,7 @@
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -65,7 +65,7 @@
 public OA (com.arjuna.orbportability.orb.core.ORB theORB)
     {
 	initialise();
-	
+
 	_theORB = theORB;
     }
 
@@ -89,7 +89,7 @@
     {
 	((POAImple) _theOA).destroyRootPOA();
     }
-    
+
 public void destroyPOA (String adapterName) throws SystemException
     {
 	((POAImple) _theOA).destroyPOA(adapterName);
@@ -99,17 +99,17 @@
     {
 	return ((POAImple) _theOA).rootPoa();
     }
-    
+
 public void rootPoa (org.omg.PortableServer.POA thePOA) throws SystemException
     {
 	((POAImple) _theOA).rootPoa(thePOA);
     }
- 
+
 public org.omg.PortableServer.POA poa (String adapterName) throws SystemException
     {
 	return ((POAImple) _theOA).poa(adapterName);
     }
-    
+
 public void poa (String adapterName, org.omg.PortableServer.POA thePOA) throws SystemException
     {
 	((POAImple) _theOA).poa(adapterName, thePOA);
@@ -119,7 +119,7 @@
     {
 	_theOA.run(_theORB, name);
     }
-    
+
 public void run () throws SystemException
     {
 	_theOA.run(_theORB);
@@ -132,13 +132,13 @@
 private final void initialise ()
     {
 	String className = opPropertyManager.propertyManager.getProperty(com.arjuna.orbportability.common.Environment.OA_IMPLEMENTATION);
-	
+
 	if (className == null)
 	{
 	    try
 	    {
 		Thread.currentThread().getContextClassLoader().loadClass("com.iona.corba.art.artimpl.ORBImpl");
-	    	
+
 	    	className = "com.arjuna.orbportability.internal.orbspecific.orbix2000.oa.implementations.orbix2000_2_0";
 	    }
 	    catch (ClassNotFoundException oe)
@@ -146,7 +146,7 @@
     		try
     		{
     		    Thread.currentThread().getContextClassLoader().loadClass("com.hp.mw.hporb.ORB");
-    			
+
 	    	    className = "com.arjuna.orbportability.internal.orbspecific.hporb.oa.implementations.hporb_1_2";
     		}
     		catch (ClassNotFoundException he)
@@ -171,7 +171,10 @@
 			    {
 				opLogger.loggerI18N.fatal( "com.arjuna.orbportability.oa.core.OA.nosupportedorb" );
 			    }
-			    throw new ExceptionInInitializerError( opLogger.logMesg.getString("com.arjuna.orbportability.oa.core.OA.nosupportedorb") );
+                ExceptionInInitializerError exceptionInInitializerError =
+                        new ExceptionInInitializerError( opLogger.logMesg.getString("com.arjuna.orbportability.oa.core.OA.nosupportedorb") );
+                exceptionInInitializerError.initCause(je);
+                throw exceptionInInitializerError;
 			}
 		    }
 	    	}
@@ -199,12 +202,15 @@
                                 new Object[] { e } );
             }
 
-	    throw new ExceptionInInitializerError( opLogger.logMesg.getString("com.arjuna.orbportability.oa.core.OA.caughtexception") );
+        ExceptionInInitializerError exceptionInInitializerError =
+                new ExceptionInInitializerError( opLogger.logMesg.getString("com.arjuna.orbportability.oa.core.OA.caughtexception") );
+        exceptionInInitializerError.initCause(e);
+        throw exceptionInInitializerError;
 	}
     }
 
 private com.arjuna.orbportability.orb.core.ORB     _theORB;
 private com.arjuna.orbportability.oa.core.POAImple _theOA;
- 
+
 }
 

Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/orb/core/ORB.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/orb/core/ORB.java	2009-05-08 08:59:57 UTC (rev 26427)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/orb/core/ORB.java	2009-05-08 09:41:28 UTC (rev 26428)
@@ -1,8 +1,8 @@
 /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. 
- * See the copyright.txt in the distribution for a full listing 
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
  * of individual contributors.
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
@@ -14,7 +14,7 @@
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -161,7 +161,10 @@
 				opLogger.loggerI18N.fatal( "com.arjuna.orbportability.orb.core.ORB.unsupportedorb" );
 			    }
 
-			    throw new ExceptionInInitializerError(opLogger.logMesg.getString("com.arjuna.orbportability.orb.core.ORB.unsupportedorb"));
+                ExceptionInInitializerError exceptionInInitializerError =
+                        new ExceptionInInitializerError(opLogger.logMesg.getString("com.arjuna.orbportability.orb.core.ORB.unsupportedorb"));
+                exceptionInInitializerError.initCause(je);
+                throw exceptionInInitializerError;
 			}
 		    }
 	    	}
@@ -188,7 +191,10 @@
                                 new Object[] { e } );
             }
 
-	    throw new ExceptionInInitializerError( opLogger.logMesg.getString("com.arjuna.orbportability.orb.core.ORB.caughtexception") );
+	    ExceptionInInitializerError exceptionInInitializerError =
+                new ExceptionInInitializerError( opLogger.logMesg.getString("com.arjuna.orbportability.orb.core.ORB.caughtexception") );
+        exceptionInInitializerError.initCause(e);
+        throw exceptionInInitializerError;
 	}
     }
 




More information about the jboss-svn-commits mailing list