From 7ce1d59319a770f54aabd739a7824dcd88eeb768 Mon Sep 17 00:00:00 2001 From: czpilar Date: Fri, 4 Apr 2025 10:44:41 +0200 Subject: [PATCH] Migrated javax.transaction to jakarta.transaction --- .github/dependabot.yml | 2 +- pom.xml | 27 ++++++++++++++++--- .../dbcp2/managed/BasicManagedDataSource.java | 4 +-- .../DataSourceXAConnectionFactory.java | 4 +-- .../managed/LocalXAConnectionFactory.java | 4 +-- .../dbcp2/managed/SynchronizationAdapter.java | 2 +- .../dbcp2/managed/TransactionContext.java | 12 ++++----- .../dbcp2/managed/TransactionRegistry.java | 8 +++--- .../managed/TestBasicManagedDataSource.java | 4 +-- .../managed/TestConnectionWithNarayana.java | 4 +-- .../dbcp2/managed/TestManagedConnection.java | 14 +++++----- .../TestManagedConnectionCachedState.java | 2 +- .../dbcp2/managed/TestManagedDataSource.java | 2 +- .../managed/TestManagedDataSourceInTx.java | 4 +-- .../TestPoolableManagedConnection.java | 2 +- .../managed/TestSynchronizationOrder.java | 14 +++++----- .../dbcp2/transaction/TransactionAdapter.java | 12 ++++----- .../TransactionManagerAdapter.java | 16 +++++------ ...sactionSynchronizationRegistryAdapter.java | 4 +-- 19 files changed, 80 insertions(+), 61 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 625eadcbc6..e7d4f8030c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -20,7 +20,7 @@ updates: schedule: interval: "quarterly" ignore: - - dependency-name: org.jboss.narayana.jta:narayana-jta + - dependency-name: org.jboss.narayana.jta:narayana-jta-jakarta versions: # require Java 11 - ">= 5.13.0" diff --git a/pom.xml b/pom.xml index 821416f5a6..fa1efa6da0 100644 --- a/pom.xml +++ b/pom.xml @@ -88,7 +88,19 @@ jakarta.transaction jakarta.transaction-api - 1.3.3 + 2.0.1 + + + jakarta.enterprise + jakarta.enterprise.cdi-api + 4.1.0 + provided + + + jakarta.interceptor + jakarta.interceptor-api + 2.2.0 + provided @@ -105,10 +117,11 @@ - org.apache.geronimo.modules + org.apache.geronimo.components geronimo-transaction - 2.2.1 + 3.1.5 test + jakarta org.junit.jupiter @@ -135,11 +148,17 @@ org.jboss.narayana.jta - narayana-jta + narayana-jta-jakarta 5.12.7.Final test + + jakarta.el + jakarta.el-api + 5.0.1 + test + org.jboss jboss-transaction-spi diff --git a/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java b/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java index 8ffb046172..3286e500b7 100644 --- a/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java +++ b/src/main/java/org/apache/commons/dbcp2/managed/BasicManagedDataSource.java @@ -20,8 +20,8 @@ import javax.sql.DataSource; import javax.sql.XADataSource; -import javax.transaction.TransactionManager; -import javax.transaction.TransactionSynchronizationRegistry; +import jakarta.transaction.TransactionManager; +import jakarta.transaction.TransactionSynchronizationRegistry; import org.apache.commons.dbcp2.BasicDataSource; import org.apache.commons.dbcp2.ConnectionFactory; diff --git a/src/main/java/org/apache/commons/dbcp2/managed/DataSourceXAConnectionFactory.java b/src/main/java/org/apache/commons/dbcp2/managed/DataSourceXAConnectionFactory.java index 9fef3b85a1..a427a508d9 100644 --- a/src/main/java/org/apache/commons/dbcp2/managed/DataSourceXAConnectionFactory.java +++ b/src/main/java/org/apache/commons/dbcp2/managed/DataSourceXAConnectionFactory.java @@ -25,8 +25,8 @@ import javax.sql.PooledConnection; import javax.sql.XAConnection; import javax.sql.XADataSource; -import javax.transaction.TransactionManager; -import javax.transaction.TransactionSynchronizationRegistry; +import jakarta.transaction.TransactionManager; +import jakarta.transaction.TransactionSynchronizationRegistry; import javax.transaction.xa.XAResource; import org.apache.commons.dbcp2.Utils; diff --git a/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java b/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java index d4bbd80276..bdf3c36447 100644 --- a/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java +++ b/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java @@ -20,8 +20,8 @@ import java.sql.SQLException; import java.util.Objects; -import javax.transaction.TransactionManager; -import javax.transaction.TransactionSynchronizationRegistry; +import jakarta.transaction.TransactionManager; +import jakarta.transaction.TransactionSynchronizationRegistry; import javax.transaction.xa.XAException; import javax.transaction.xa.XAResource; import javax.transaction.xa.Xid; diff --git a/src/main/java/org/apache/commons/dbcp2/managed/SynchronizationAdapter.java b/src/main/java/org/apache/commons/dbcp2/managed/SynchronizationAdapter.java index 4b56d9073e..d571669f2e 100644 --- a/src/main/java/org/apache/commons/dbcp2/managed/SynchronizationAdapter.java +++ b/src/main/java/org/apache/commons/dbcp2/managed/SynchronizationAdapter.java @@ -16,7 +16,7 @@ */ package org.apache.commons.dbcp2.managed; -import javax.transaction.Synchronization; +import jakarta.transaction.Synchronization; /** * Implements {@link Synchronization} for subclasses. diff --git a/src/main/java/org/apache/commons/dbcp2/managed/TransactionContext.java b/src/main/java/org/apache/commons/dbcp2/managed/TransactionContext.java index 76487b6ff3..a739f23e7b 100644 --- a/src/main/java/org/apache/commons/dbcp2/managed/TransactionContext.java +++ b/src/main/java/org/apache/commons/dbcp2/managed/TransactionContext.java @@ -21,12 +21,12 @@ import java.sql.SQLException; import java.util.Objects; -import javax.transaction.RollbackException; -import javax.transaction.Status; -import javax.transaction.Synchronization; -import javax.transaction.SystemException; -import javax.transaction.Transaction; -import javax.transaction.TransactionSynchronizationRegistry; +import jakarta.transaction.RollbackException; +import jakarta.transaction.Status; +import jakarta.transaction.Synchronization; +import jakarta.transaction.SystemException; +import jakarta.transaction.Transaction; +import jakarta.transaction.TransactionSynchronizationRegistry; import javax.transaction.xa.XAResource; /** diff --git a/src/main/java/org/apache/commons/dbcp2/managed/TransactionRegistry.java b/src/main/java/org/apache/commons/dbcp2/managed/TransactionRegistry.java index 60d32c7e5a..4725412147 100644 --- a/src/main/java/org/apache/commons/dbcp2/managed/TransactionRegistry.java +++ b/src/main/java/org/apache/commons/dbcp2/managed/TransactionRegistry.java @@ -22,10 +22,10 @@ import java.util.Objects; import java.util.WeakHashMap; -import javax.transaction.SystemException; -import javax.transaction.Transaction; -import javax.transaction.TransactionManager; -import javax.transaction.TransactionSynchronizationRegistry; +import jakarta.transaction.SystemException; +import jakarta.transaction.Transaction; +import jakarta.transaction.TransactionManager; +import jakarta.transaction.TransactionSynchronizationRegistry; import javax.transaction.xa.XAResource; import org.apache.commons.dbcp2.DelegatingConnection; diff --git a/src/test/java/org/apache/commons/dbcp2/managed/TestBasicManagedDataSource.java b/src/test/java/org/apache/commons/dbcp2/managed/TestBasicManagedDataSource.java index 52adca8569..418a294799 100644 --- a/src/test/java/org/apache/commons/dbcp2/managed/TestBasicManagedDataSource.java +++ b/src/test/java/org/apache/commons/dbcp2/managed/TestBasicManagedDataSource.java @@ -28,8 +28,8 @@ Licensed to the Apache Software Foundation (ASF) under one or more import java.sql.SQLException; import javax.sql.XADataSource; -import javax.transaction.TransactionManager; -import javax.transaction.TransactionSynchronizationRegistry; +import jakarta.transaction.TransactionManager; +import jakarta.transaction.TransactionSynchronizationRegistry; import javax.transaction.xa.XAException; import org.apache.commons.dbcp2.BasicDataSource; diff --git a/src/test/java/org/apache/commons/dbcp2/managed/TestConnectionWithNarayana.java b/src/test/java/org/apache/commons/dbcp2/managed/TestConnectionWithNarayana.java index b27c1e2337..d26c4c00c5 100644 --- a/src/test/java/org/apache/commons/dbcp2/managed/TestConnectionWithNarayana.java +++ b/src/test/java/org/apache/commons/dbcp2/managed/TestConnectionWithNarayana.java @@ -28,8 +28,8 @@ Licensed to the Apache Software Foundation (ASF) under one or more import java.sql.Timestamp; import java.time.Duration; -import javax.transaction.RollbackException; -import javax.transaction.Status; +import jakarta.transaction.RollbackException; +import jakarta.transaction.Status; import org.apache.commons.dbcp2.Utils; import org.junit.jupiter.api.AfterEach; diff --git a/src/test/java/org/apache/commons/dbcp2/managed/TestManagedConnection.java b/src/test/java/org/apache/commons/dbcp2/managed/TestManagedConnection.java index 4715bbcf5d..df1ecbae7b 100644 --- a/src/test/java/org/apache/commons/dbcp2/managed/TestManagedConnection.java +++ b/src/test/java/org/apache/commons/dbcp2/managed/TestManagedConnection.java @@ -26,13 +26,13 @@ Licensed to the Apache Software Foundation (ASF) under one or more import java.time.Duration; import java.util.Properties; -import javax.transaction.HeuristicMixedException; -import javax.transaction.HeuristicRollbackException; -import javax.transaction.RollbackException; -import javax.transaction.Synchronization; -import javax.transaction.SystemException; -import javax.transaction.Transaction; -import javax.transaction.TransactionManager; +import jakarta.transaction.HeuristicMixedException; +import jakarta.transaction.HeuristicRollbackException; +import jakarta.transaction.RollbackException; +import jakarta.transaction.Synchronization; +import jakarta.transaction.SystemException; +import jakarta.transaction.Transaction; +import jakarta.transaction.TransactionManager; import javax.transaction.xa.XAResource; import org.apache.commons.dbcp2.ConnectionFactory; diff --git a/src/test/java/org/apache/commons/dbcp2/managed/TestManagedConnectionCachedState.java b/src/test/java/org/apache/commons/dbcp2/managed/TestManagedConnectionCachedState.java index d32c7c1210..79ab16216e 100644 --- a/src/test/java/org/apache/commons/dbcp2/managed/TestManagedConnectionCachedState.java +++ b/src/test/java/org/apache/commons/dbcp2/managed/TestManagedConnectionCachedState.java @@ -25,7 +25,7 @@ import java.util.List; import java.util.Properties; -import javax.transaction.TransactionManager; +import jakarta.transaction.TransactionManager; import javax.transaction.xa.XAException; import org.apache.commons.dbcp2.ConnectionFactory; diff --git a/src/test/java/org/apache/commons/dbcp2/managed/TestManagedDataSource.java b/src/test/java/org/apache/commons/dbcp2/managed/TestManagedDataSource.java index 8bc9ed6702..9a6fca4242 100644 --- a/src/test/java/org/apache/commons/dbcp2/managed/TestManagedDataSource.java +++ b/src/test/java/org/apache/commons/dbcp2/managed/TestManagedDataSource.java @@ -28,7 +28,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more import java.sql.Connection; import java.util.Properties; -import javax.transaction.TransactionManager; +import jakarta.transaction.TransactionManager; import org.apache.commons.dbcp2.ConnectionFactory; import org.apache.commons.dbcp2.Constants; diff --git a/src/test/java/org/apache/commons/dbcp2/managed/TestManagedDataSourceInTx.java b/src/test/java/org/apache/commons/dbcp2/managed/TestManagedDataSourceInTx.java index d63cd642b9..55c51d545e 100644 --- a/src/test/java/org/apache/commons/dbcp2/managed/TestManagedDataSourceInTx.java +++ b/src/test/java/org/apache/commons/dbcp2/managed/TestManagedDataSourceInTx.java @@ -33,8 +33,8 @@ Licensed to the Apache Software Foundation (ASF) under one or more import java.sql.SQLException; import java.sql.Statement; -import javax.transaction.Synchronization; -import javax.transaction.Transaction; +import jakarta.transaction.Synchronization; +import jakarta.transaction.Transaction; import org.apache.commons.dbcp2.DelegatingConnection; import org.junit.jupiter.api.AfterEach; diff --git a/src/test/java/org/apache/commons/dbcp2/managed/TestPoolableManagedConnection.java b/src/test/java/org/apache/commons/dbcp2/managed/TestPoolableManagedConnection.java index 929acc5700..fd87a1cf11 100644 --- a/src/test/java/org/apache/commons/dbcp2/managed/TestPoolableManagedConnection.java +++ b/src/test/java/org/apache/commons/dbcp2/managed/TestPoolableManagedConnection.java @@ -27,7 +27,7 @@ import java.time.Duration; import java.util.Properties; -import javax.transaction.TransactionManager; +import jakarta.transaction.TransactionManager; import org.apache.commons.dbcp2.ConnectionFactory; import org.apache.commons.dbcp2.Constants; diff --git a/src/test/java/org/apache/commons/dbcp2/managed/TestSynchronizationOrder.java b/src/test/java/org/apache/commons/dbcp2/managed/TestSynchronizationOrder.java index aeee44b269..de4e6c43be 100644 --- a/src/test/java/org/apache/commons/dbcp2/managed/TestSynchronizationOrder.java +++ b/src/test/java/org/apache/commons/dbcp2/managed/TestSynchronizationOrder.java @@ -33,13 +33,13 @@ Licensed to the Apache Software Foundation (ASF) under one or more import javax.sql.XAConnection; import javax.sql.XADataSource; -import javax.transaction.NotSupportedException; -import javax.transaction.RollbackException; -import javax.transaction.Synchronization; -import javax.transaction.SystemException; -import javax.transaction.Transaction; -import javax.transaction.TransactionManager; -import javax.transaction.TransactionSynchronizationRegistry; +import jakarta.transaction.NotSupportedException; +import jakarta.transaction.RollbackException; +import jakarta.transaction.Synchronization; +import jakarta.transaction.SystemException; +import jakarta.transaction.Transaction; +import jakarta.transaction.TransactionManager; +import jakarta.transaction.TransactionSynchronizationRegistry; import javax.transaction.xa.XAResource; import org.apache.commons.dbcp2.BasicDataSource; diff --git a/src/test/java/org/apache/commons/dbcp2/transaction/TransactionAdapter.java b/src/test/java/org/apache/commons/dbcp2/transaction/TransactionAdapter.java index d11f0d7d35..7dc6d435ff 100644 --- a/src/test/java/org/apache/commons/dbcp2/transaction/TransactionAdapter.java +++ b/src/test/java/org/apache/commons/dbcp2/transaction/TransactionAdapter.java @@ -17,12 +17,12 @@ package org.apache.commons.dbcp2.transaction; -import javax.transaction.HeuristicMixedException; -import javax.transaction.HeuristicRollbackException; -import javax.transaction.RollbackException; -import javax.transaction.Synchronization; -import javax.transaction.SystemException; -import javax.transaction.Transaction; +import jakarta.transaction.HeuristicMixedException; +import jakarta.transaction.HeuristicRollbackException; +import jakarta.transaction.RollbackException; +import jakarta.transaction.Synchronization; +import jakarta.transaction.SystemException; +import jakarta.transaction.Transaction; import javax.transaction.xa.XAResource; /** diff --git a/src/test/java/org/apache/commons/dbcp2/transaction/TransactionManagerAdapter.java b/src/test/java/org/apache/commons/dbcp2/transaction/TransactionManagerAdapter.java index 0e1c079771..7e26a36d23 100644 --- a/src/test/java/org/apache/commons/dbcp2/transaction/TransactionManagerAdapter.java +++ b/src/test/java/org/apache/commons/dbcp2/transaction/TransactionManagerAdapter.java @@ -17,14 +17,14 @@ package org.apache.commons.dbcp2.transaction; -import javax.transaction.HeuristicMixedException; -import javax.transaction.HeuristicRollbackException; -import javax.transaction.InvalidTransactionException; -import javax.transaction.NotSupportedException; -import javax.transaction.RollbackException; -import javax.transaction.SystemException; -import javax.transaction.Transaction; -import javax.transaction.TransactionManager; +import jakarta.transaction.HeuristicMixedException; +import jakarta.transaction.HeuristicRollbackException; +import jakarta.transaction.InvalidTransactionException; +import jakarta.transaction.NotSupportedException; +import jakarta.transaction.RollbackException; +import jakarta.transaction.SystemException; +import jakarta.transaction.Transaction; +import jakarta.transaction.TransactionManager; /** * A TransactionManager adapter. diff --git a/src/test/java/org/apache/commons/dbcp2/transaction/TransactionSynchronizationRegistryAdapter.java b/src/test/java/org/apache/commons/dbcp2/transaction/TransactionSynchronizationRegistryAdapter.java index 34b6a41a2f..71c6fc14c9 100644 --- a/src/test/java/org/apache/commons/dbcp2/transaction/TransactionSynchronizationRegistryAdapter.java +++ b/src/test/java/org/apache/commons/dbcp2/transaction/TransactionSynchronizationRegistryAdapter.java @@ -17,8 +17,8 @@ package org.apache.commons.dbcp2.transaction; -import javax.transaction.Synchronization; -import javax.transaction.TransactionSynchronizationRegistry; +import jakarta.transaction.Synchronization; +import jakarta.transaction.TransactionSynchronizationRegistry; /** * A TransactionSynchronizationRegistry adapter.