[jboss-svn-commits] JBL Code SVN: r23645 - in labs/jbosstm/trunk/XTS/WSTX: classes10/com/arjuna/mwlabs/wst/at/remote and 4 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Oct 31 07:26:41 EDT 2008
Author: adinn
Date: 2008-10-31 07:26:41 -0400 (Fri, 31 Oct 2008)
New Revision: 23645
Modified:
labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/UserBusinessActivity.java
labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/UserTransaction.java
labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mwlabs/wst/at/remote/UserTransactionImple.java
labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mwlabs/wst/ba/remote/UserBusinessActivityImple.java
labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/UserBusinessActivity.java
labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/UserTransaction.java
labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserTransactionImple.java
labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/ba/remote/UserBusinessActivityImple.java
Log:
added check for null context to various TX management methods and generated a WrongStateException if detected -- n.b. this changes, albeit by conservative extension, the exception list of the affected methods in the API classes UserTransaction and UserBusinessActivity. fixes JBTM-422
Modified: labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/UserBusinessActivity.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/UserBusinessActivity.java 2008-10-31 10:03:14 UTC (rev 23644)
+++ labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/UserBusinessActivity.java 2008-10-31 11:26:41 UTC (rev 23645)
@@ -104,14 +104,14 @@
* is required.
*/
public abstract void close()
- throws TransactionRolledBackException, UnknownTransactionException, SystemException;
+ throws TransactionRolledBackException, UnknownTransactionException, SystemException, WrongStateException;
/**
* If the BA must undo its work then the cancel method is used. Any
* participants that can compensate are forced to do so.
*/
public abstract void cancel()
- throws UnknownTransactionException, SystemException;
+ throws UnknownTransactionException, SystemException, WrongStateException;
/**
* If participants have registered for the BusinessAgreementWithComplete
@@ -120,7 +120,7 @@
* complete method is used for this purpose.
*/
public abstract void complete()
- throws UnknownTransactionException, SystemException;
+ throws UnknownTransactionException, SystemException, WrongStateException;
public abstract String transactionIdentifier();
}
Modified: labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/UserTransaction.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/UserTransaction.java 2008-10-31 10:03:14 UTC (rev 23644)
+++ labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mw/wst/UserTransaction.java 2008-10-31 11:26:41 UTC (rev 23645)
@@ -97,22 +97,28 @@
* The transaction is committed by the commit method. This will execute
* the PhaseZero, 2PC and OutcomeNotification protocols prior to returning.
* If there is no transaction associated with the invoking thread then
- * UnknownTransactionException is thrown. If the transaction ultimately
- * rolls back then the TransactionRolledBackException is thrown. When
- * complete, this operation disassociates the transaction from the current
- * thread such that it becomes associated with no transaction.
+ * WrongStateException is thrown. If the coordinator is not aware of the
+ * current transaction UnknownTransactionException is thrown. If the transaction
+ * ultimately rolls back then the TransactionRolledBackException is thrown.
+ * If any other error occurs a SystemException is thrown. When complete, this
+ * operation disassociates the transaction from the current thread such that
+ * it becomes associated with no transaction.
*/
public abstract void commit()
- throws TransactionRolledBackException, UnknownTransactionException, SecurityException, SystemException;
+ throws TransactionRolledBackException, UnknownTransactionException, SecurityException, SystemException, WrongStateException;
/**
* The rollback operation will terminate the transaction and return
* normally if it succeeded, while throwing an appropriate exception if it
* didn't. If there is no transaction associated with the invoking thread
- * then UnknownTransactionException is thrown.
+ * then WrongStateException is thrown. If the coordinator is not aware of the
+ * current transaction UnknownTransactionException is thrown. If any other error
+ * occurs a SystemException is thrown. When complete, this operation disassociates
+ * the transaction from the current thread such that it becomes associated with no
+ * transaction.
*/
public abstract void rollback()
- throws UnknownTransactionException, SecurityException, SystemException;
+ throws UnknownTransactionException, SecurityException, SystemException, WrongStateException;
public abstract String transactionIdentifier ();
}
Modified: labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mwlabs/wst/at/remote/UserTransactionImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mwlabs/wst/at/remote/UserTransactionImple.java 2008-10-31 10:03:14 UTC (rev 23644)
+++ labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mwlabs/wst/at/remote/UserTransactionImple.java 2008-10-31 11:26:41 UTC (rev 23645)
@@ -130,7 +130,7 @@
}
public void commit () throws TransactionRolledBackException,
- UnknownTransactionException, SecurityException, SystemException
+ UnknownTransactionException, SecurityException, SystemException, WrongStateException
{
try
{
@@ -146,7 +146,7 @@
}
}
- public void rollback () throws UnknownTransactionException, SecurityException, SystemException
+ public void rollback () throws UnknownTransactionException, SecurityException, SystemException, WrongStateException
{
try
{
@@ -244,7 +244,7 @@
private final void commitWithoutAck ()
throws TransactionRolledBackException, UnknownTransactionException,
- SecurityException, SystemException
+ SecurityException, SystemException, WrongStateException
{
TxContextImple ctx = null;
String id = null;
@@ -253,7 +253,7 @@
{
ctx = (TxContextImple) _ctxManager.suspend();
if (ctx == null) {
- throw new UnknownTransactionException();
+ throw new WrongStateException();
}
id = ctx.identifier();
@@ -283,6 +283,10 @@
{
throw ex;
}
+ catch (WrongStateException ex)
+ {
+ throw ex;
+ }
catch (UnknownTransactionException ex)
{
throw ex;
@@ -315,7 +319,7 @@
}
private final void abortWithoutAck () throws UnknownTransactionException, SecurityException,
- SystemException
+ SystemException, WrongStateException
{
TxContextImple ctx = null;
String id = null;
@@ -323,6 +327,9 @@
try
{
ctx = (TxContextImple) _ctxManager.suspend();
+ if (ctx == null) {
+ throw new WrongStateException();
+ }
id = ctx.identifier();
/*
@@ -351,6 +358,10 @@
{
throw ex;
}
+ catch (WrongStateException ex)
+ {
+ throw ex;
+ }
catch (SecurityException ex)
{
throw ex;
Modified: labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mwlabs/wst/ba/remote/UserBusinessActivityImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mwlabs/wst/ba/remote/UserBusinessActivityImple.java 2008-10-31 10:03:14 UTC (rev 23644)
+++ labs/jbosstm/trunk/XTS/WSTX/classes10/com/arjuna/mwlabs/wst/ba/remote/UserBusinessActivityImple.java 2008-10-31 11:26:41 UTC (rev 23645)
@@ -129,13 +129,16 @@
}
}
- public void close () throws TransactionRolledBackException, UnknownTransactionException, SystemException
+ public void close () throws TransactionRolledBackException, UnknownTransactionException, SystemException, WrongStateException
{
TxContextImple ctx = null;
try
{
ctx = (TxContextImple) _ctxManager.suspend();
+ if (ctx == null) {
+ throw new WrongStateException();
+ }
final String id = ctx.identifier() ;
final EndpointReferenceType terminatorCoordinator = getTerminationCoordinator(ctx) ;
@@ -156,6 +159,10 @@
{
throw ex;
}
+ catch (WrongStateException ex)
+ {
+ throw ex;
+ }
catch (Exception ex)
{
ex.printStackTrace();
@@ -168,14 +175,17 @@
}
}
- public void cancel () throws UnknownTransactionException, SystemException
+ public void cancel () throws UnknownTransactionException, SystemException, WrongStateException
{
TxContextImple ctx = null;
try
{
ctx = (TxContextImple) _ctxManager.suspend();
-
+ if (ctx == null) {
+ throw new WrongStateException();
+ }
+
final String id = ctx.identifier() ;
final EndpointReferenceType terminatorCoordinator = getTerminationCoordinator(ctx) ;
@@ -191,6 +201,10 @@
{
throw ex;
}
+ catch (WrongStateException ex)
+ {
+ throw ex;
+ }
catch (Exception ex)
{
ex.printStackTrace();
@@ -203,11 +217,14 @@
}
}
- public void complete () throws UnknownTransactionException, SystemException
+ public void complete () throws UnknownTransactionException, SystemException, WrongStateException
{
try
{
final TxContextImple ctx = ((TxContextImple) _ctxManager.currentTransaction()) ;
+ if (ctx == null) {
+ throw new WrongStateException();
+ }
final String id = ctx.identifier() ;
final EndpointReferenceType terminatorCoordinator = getTerminationCoordinator(ctx) ;
@@ -223,6 +240,10 @@
{
throw ex;
}
+ catch (WrongStateException ex)
+ {
+ throw ex;
+ }
catch (Exception ex)
{
throw new SystemException(ex.toString());
Modified: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/UserBusinessActivity.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/UserBusinessActivity.java 2008-10-31 10:03:14 UTC (rev 23644)
+++ labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/UserBusinessActivity.java 2008-10-31 11:26:41 UTC (rev 23645)
@@ -104,14 +104,14 @@
* is required.
*/
public abstract void close()
- throws TransactionRolledBackException, UnknownTransactionException, SystemException;
+ throws TransactionRolledBackException, UnknownTransactionException, SystemException, WrongStateException;
/**
* If the BA must undo its work then the cancel method is used. Any
* participants that can compensate are forced to do so.
*/
public abstract void cancel()
- throws UnknownTransactionException, SystemException;
+ throws UnknownTransactionException, SystemException, WrongStateException;
/**
* If participants have registered for the BusinessAgreementWithComplete
@@ -120,7 +120,7 @@
* complete method is used for this purpose.
*/
public abstract void complete()
- throws UnknownTransactionException, SystemException;
+ throws UnknownTransactionException, SystemException, WrongStateException;
public abstract String transactionIdentifier();
}
\ No newline at end of file
Modified: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/UserTransaction.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/UserTransaction.java 2008-10-31 10:03:14 UTC (rev 23644)
+++ labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/UserTransaction.java 2008-10-31 11:26:41 UTC (rev 23645)
@@ -97,22 +97,28 @@
* The transaction is committed by the commit method. This will execute
* the PhaseZero, 2PC and OutcomeNotification protocols prior to returning.
* If there is no transaction associated with the invoking thread then
- * UnknownTransactionException is thrown. If the transaction ultimately
- * rolls back then the TransactionRolledBackException is thrown. When
- * complete, this operation disassociates the transaction from the current
- * thread such that it becomes associated with no transaction.
+ * WrongStateException is thrown. If the coordinator is not aware of the
+ * current transaction UnknownTransactionException is thrown. If the transaction
+ * ultimately rolls back then the TransactionRolledBackException is thrown.
+ * If any other error occurs a SystemException is thrown. When complete, this
+ * operation disassociates the transaction from the current thread such that
+ * it becomes associated with no transaction.
*/
public abstract void commit()
- throws TransactionRolledBackException, UnknownTransactionException, SecurityException, SystemException;
+ throws TransactionRolledBackException, UnknownTransactionException, SecurityException, SystemException, WrongStateException;
/**
* The rollback operation will terminate the transaction and return
* normally if it succeeded, while throwing an appropriate exception if it
* didn't. If there is no transaction associated with the invoking thread
- * then UnknownTransactionException is thrown.
+ * then WrongStateException is thrown. If the coordinator is not aware of the
+ * current transaction UnknownTransactionException is thrown. If any other error
+ * occurs a SystemException is thrown. When complete, this operation disassociates
+ * the transaction from the current thread such that it becomes associated with no
+ * transaction.
*/
public abstract void rollback()
- throws UnknownTransactionException, SecurityException, SystemException;
+ throws UnknownTransactionException, SecurityException, SystemException, WrongStateException;
public abstract String transactionIdentifier ();
}
\ No newline at end of file
Modified: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserTransactionImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserTransactionImple.java 2008-10-31 10:03:14 UTC (rev 23644)
+++ labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserTransactionImple.java 2008-10-31 11:26:41 UTC (rev 23645)
@@ -102,7 +102,7 @@
}
public void commit () throws TransactionRolledBackException,
- UnknownTransactionException, SecurityException, SystemException
+ UnknownTransactionException, SecurityException, SystemException, WrongStateException
{
try
{
@@ -118,7 +118,7 @@
}
}
- public void rollback () throws UnknownTransactionException, SecurityException, SystemException
+ public void rollback () throws UnknownTransactionException, SecurityException, SystemException, WrongStateException
{
try
{
@@ -217,7 +217,7 @@
private final void commitWithoutAck ()
throws TransactionRolledBackException, UnknownTransactionException,
- SecurityException, SystemException
+ SecurityException, SystemException, WrongStateException
{
TxContextImple ctx = null;
String id = null;
@@ -225,6 +225,9 @@
try
{
ctx = (TxContextImple) _ctxManager.suspend();
+ if (ctx == null) {
+ throw new WrongStateException();
+ }
id = ctx.identifier();
/*
@@ -285,7 +288,7 @@
}
private final void abortWithoutAck () throws UnknownTransactionException, SecurityException,
- SystemException
+ SystemException, WrongStateException
{
TxContextImple ctx = null;
String id = null;
@@ -293,6 +296,9 @@
try
{
ctx = (TxContextImple) _ctxManager.suspend();
+ if (ctx == null) {
+ throw new WrongStateException();
+ }
id = ctx.identifier();
/*
Modified: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/ba/remote/UserBusinessActivityImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/ba/remote/UserBusinessActivityImple.java 2008-10-31 10:03:14 UTC (rev 23644)
+++ labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/ba/remote/UserBusinessActivityImple.java 2008-10-31 11:26:41 UTC (rev 23645)
@@ -133,13 +133,16 @@
}
}
- public void close () throws TransactionRolledBackException, UnknownTransactionException, SystemException
+ public void close () throws TransactionRolledBackException, UnknownTransactionException, SystemException, WrongStateException
{
TxContextImple ctx = null;
try
{
ctx = (TxContextImple) _ctxManager.suspend();
+ if (ctx == null) {
+ throw new WrongStateException();
+ }
final String id = ctx.identifier() ;
final W3CEndpointReference terminatorCoordinator = getTerminationCoordinator(ctx) ;
@@ -156,6 +159,10 @@
{
throw ex;
}
+ catch (WrongStateException ex)
+ {
+ throw ex;
+ }
catch (UnknownTransactionException ex)
{
throw ex;
@@ -172,13 +179,16 @@
}
}
- public void cancel () throws UnknownTransactionException, SystemException
+ public void cancel () throws UnknownTransactionException, SystemException, WrongStateException
{
TxContextImple ctx = null;
try
{
ctx = (TxContextImple) _ctxManager.suspend();
+ if (ctx == null) {
+ throw new WrongStateException();
+ }
final String id = ctx.identifier() ;
final W3CEndpointReference terminatorCoordinator = getTerminationCoordinator(ctx) ;
@@ -191,6 +201,10 @@
{
throw ex;
}
+ catch (WrongStateException ex)
+ {
+ throw ex;
+ }
catch (UnknownTransactionException ex)
{
throw ex;
@@ -207,11 +221,14 @@
}
}
- public void complete () throws UnknownTransactionException, SystemException
+ public void complete () throws UnknownTransactionException, SystemException, WrongStateException
{
try
{
final TxContextImple ctx = ((TxContextImple) _ctxManager.currentTransaction()) ;
+ if (ctx == null) {
+ throw new WrongStateException();
+ }
final String id = ctx.identifier() ;
final W3CEndpointReference terminatorCoordinator = getTerminationCoordinator(ctx) ;
@@ -227,6 +244,10 @@
{
throw ex;
}
+ catch (WrongStateException ex)
+ {
+ throw ex;
+ }
catch (Exception ex)
{
throw new SystemException(ex.toString());
More information about the jboss-svn-commits
mailing list