You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by ti...@apache.org on 2018/01/23 16:40:52 UTC

[aries-tx-control] branch master updated (e1afa6d -> 9d241cd)

This is an automated email from the ASF dual-hosted git repository.

timothyjward pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/aries-tx-control.git.


    from e1afa6d  Tx Control spec compliance
     new 63ce9b1  Tx Control spec compliance - failing the CT due to unwrapping failure
     new 9d241cd  Ensure that a RollbackException is generated for unexpected failures

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../xa/impl/JDBCConnectionProviderFactoryImpl.java | 28 +++++++++++++++-------
 .../service/xa/impl/TransactionContextImpl.java    |  4 ++++
 2 files changed, 23 insertions(+), 9 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
timothyjward@apache.org.

[aries-tx-control] 01/02: Tx Control spec compliance - failing the CT due to unwrapping failure

Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

timothyjward pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-tx-control.git

commit 63ce9b15944ae81c6ab42672f8518063fd556ad6
Author: Tim Ward <ti...@apache.org>
AuthorDate: Tue Jan 23 11:35:05 2018 -0500

    Tx Control spec compliance - failing the CT due to unwrapping failure
---
 .../xa/impl/JDBCConnectionProviderFactoryImpl.java | 28 +++++++++++++++-------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/tx-control-providers/jdbc/tx-control-provider-jdbc-xa/src/main/java/org/apache/aries/tx/control/jdbc/xa/impl/JDBCConnectionProviderFactoryImpl.java b/tx-control-providers/jdbc/tx-control-provider-jdbc-xa/src/main/java/org/apache/aries/tx/control/jdbc/xa/impl/JDBCConnectionProviderFactoryImpl.java
index 7d1e5b4..34c3f86 100644
--- a/tx-control-providers/jdbc/tx-control-provider-jdbc-xa/src/main/java/org/apache/aries/tx/control/jdbc/xa/impl/JDBCConnectionProviderFactoryImpl.java
+++ b/tx-control-providers/jdbc/tx-control-provider-jdbc-xa/src/main/java/org/apache/aries/tx/control/jdbc/xa/impl/JDBCConnectionProviderFactoryImpl.java
@@ -93,16 +93,26 @@ public class JDBCConnectionProviderFactoryImpl extends AbstractInternalJDBCConne
 		boolean xaEnabled = toBoolean(resourceProviderProperties, XA_ENLISTMENT_ENABLED, true);
 		boolean localEnabled = toBoolean(resourceProviderProperties, LOCAL_ENLISTMENT_ENABLED, true);
 		
-		try {
-			checkEnlistment(xaEnabled, localEnabled, ds.isWrapperFor(XADataSource.class));
-			DataSource toUse = poolIfNecessary(resourceProviderProperties, xaEnabled ?
-					new XADataSourceMapper(ds.unwrap(XADataSource.class)) : ds);
-	
-			return new JDBCConnectionProviderImpl(toUse, xaEnabled, localEnabled, 
-					getRecoveryId(resourceProviderProperties, xaEnabled));
-		} catch (SQLException sqle) {
-			throw new TransactionException("Unable to create the JDBC resource provider", sqle);
+		XADataSource xaDS;
+		if(ds instanceof XADataSource) {
+			xaDS = (XADataSource) ds;
+		} else {
+			try {
+				if(ds.isWrapperFor(XADataSource.class)) {
+					xaDS = ds.unwrap(XADataSource.class);
+				} else {
+					xaDS = null;
+				}
+			} catch (SQLException sqle) {
+				xaDS = null;
+			}
 		}
+		checkEnlistment(xaEnabled, localEnabled, xaDS != null);
+		DataSource toUse = poolIfNecessary(resourceProviderProperties, xaEnabled ?
+				new XADataSourceMapper(xaDS) : ds);
+
+		return new JDBCConnectionProviderImpl(toUse, xaEnabled, localEnabled, 
+				getRecoveryId(resourceProviderProperties, xaEnabled));
 	}
 
 	@Override

-- 
To stop receiving notification emails like this one, please contact
timothyjward@apache.org.

[aries-tx-control] 02/02: Ensure that a RollbackException is generated for unexpected failures

Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

timothyjward pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-tx-control.git

commit 9d241cd324299a255441672c077402c3b0dd1907
Author: Tim Ward <ti...@apache.org>
AuthorDate: Tue Jan 23 11:35:48 2018 -0500

    Ensure that a RollbackException is generated for unexpected failures
---
 .../aries/tx/control/service/xa/impl/TransactionContextImpl.java      | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tx-control-services/tx-control-service-xa/src/main/java/org/apache/aries/tx/control/service/xa/impl/TransactionContextImpl.java b/tx-control-services/tx-control-service-xa/src/main/java/org/apache/aries/tx/control/service/xa/impl/TransactionContextImpl.java
index fe58f84..678f416 100644
--- a/tx-control-services/tx-control-service-xa/src/main/java/org/apache/aries/tx/control/service/xa/impl/TransactionContextImpl.java
+++ b/tx-control-services/tx-control-service-xa/src/main/java/org/apache/aries/tx/control/service/xa/impl/TransactionContextImpl.java
@@ -53,6 +53,7 @@ import org.apache.geronimo.transaction.manager.SetRollbackOnlyException;
 import org.osgi.service.transaction.control.LocalResource;
 import org.osgi.service.transaction.control.TransactionContext;
 import org.osgi.service.transaction.control.TransactionException;
+import org.osgi.service.transaction.control.TransactionRolledBackException;
 import org.osgi.service.transaction.control.TransactionStatus;
 
 public class TransactionContextImpl extends AbstractTransactionContextImpl implements TransactionContext {
@@ -315,6 +316,9 @@ public class TransactionContextImpl extends AbstractTransactionContextImpl imple
 							// This means that a pre-completion callback called setRollbackOnly
 							// which can be safely ignored (i.e. it's not really an exception)
 						}
+						TransactionRolledBackException tre = 
+								new TransactionRolledBackException(re.getMessage(), re);
+						throw tre;
 					}
 				}
 			} catch (Exception e) {

-- 
To stop receiving notification emails like this one, please contact
timothyjward@apache.org.