commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1571755 - in /commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2: ./ managed/
Date Tue, 25 Feb 2014 17:24:41 GMT
Author: ggregory
Date: Tue Feb 25 17:24:40 2014
New Revision: 1571755

URL: http://svn.apache.org/r1571755
Log:
Convert control statement bodies to block.

Modified:
    commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
    commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/DataSourceXAConnectionFactory.java
    commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java
    commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/ManagedDataSource.java
    commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/TransactionContext.java
    commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/TransactionRegistry.java

Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java?rev=1571755&r1=1571754&r2=1571755&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
(original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java
Tue Feb 25 17:24:40 2014
@@ -1807,7 +1807,9 @@ public class BasicDataSource
      * create new connections
      */
     public void setConnectionProperties(String connectionProperties) {
-        if (connectionProperties == null) throw new NullPointerException("connectionProperties
is null");
+        if (connectionProperties == null) {
+            throw new NullPointerException("connectionProperties is null");
+        }
 
         String[] entries = connectionProperties.split(";");
         Properties properties = new Properties();

Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/DataSourceXAConnectionFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/DataSourceXAConnectionFactory.java?rev=1571755&r1=1571754&r2=1571755&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/DataSourceXAConnectionFactory.java
(original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/DataSourceXAConnectionFactory.java
Tue Feb 25 17:24:40 2014
@@ -61,8 +61,12 @@ public class DataSourceXAConnectionFacto
      * @param password the password used for authenticating new connections
      */
     public DataSourceXAConnectionFactory(TransactionManager transactionManager, XADataSource
xaDataSource, String username, String password) {
-        if (transactionManager == null) throw new NullPointerException("transactionManager
is null");
-        if (xaDataSource == null) throw new NullPointerException("xaDataSource is null");
+        if (transactionManager == null) {
+            throw new NullPointerException("transactionManager is null");
+        }
+        if (xaDataSource == null) {
+            throw new NullPointerException("xaDataSource is null");
+        }
 
         this.transactionRegistry = new TransactionRegistry(transactionManager);
         this.xaDataSource = xaDataSource;

Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java?rev=1571755&r1=1571754&r2=1571755&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java
(original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java
Tue Feb 25 17:24:40 2014
@@ -46,8 +46,12 @@ public class LocalXAConnectionFactory im
      * @param connectionFactory  the connection factory from which connections will be retrieved
      */
     public LocalXAConnectionFactory(TransactionManager transactionManager, ConnectionFactory
connectionFactory) {
-        if (transactionManager == null) throw new NullPointerException("transactionManager
is null");
-        if (connectionFactory == null) throw new NullPointerException("connectionFactory
is null");
+        if (transactionManager == null) {
+            throw new NullPointerException("transactionManager is null");
+        }
+        if (connectionFactory == null) {
+            throw new NullPointerException("connectionFactory is null");
+        }
 
         this.transactionRegistry = new TransactionRegistry(transactionManager);
         this.connectionFactory = connectionFactory;
@@ -156,8 +160,12 @@ public class LocalXAConnectionFactory im
          */
         @Override
         public synchronized void end(Xid xid, int flag) throws XAException {
-            if (xid == null) throw new NullPointerException("xid is null");
-            if (!this.currentXid.equals(xid)) throw new XAException("Invalid Xid: expected
" + this.currentXid + ", but was " + xid);
+            if (xid == null) {
+                throw new NullPointerException("xid is null");
+            }
+            if (!this.currentXid.equals(xid)) {
+                throw new XAException("Invalid Xid: expected " + this.currentXid + ", but
was " + xid);
+            }
 
             // This notification tells us that the application server is done using this
             // connection for the time being.  The connection is still associated with an
@@ -243,8 +251,12 @@ public class LocalXAConnectionFactory im
          */
         @Override
         public synchronized void rollback(Xid xid) throws XAException {
-            if (xid == null) throw new NullPointerException("xid is null");
-            if (!this.currentXid.equals(xid)) throw new XAException("Invalid Xid: expected
" + this.currentXid + ", but was " + xid);
+            if (xid == null) {
+                throw new NullPointerException("xid is null");
+            }
+            if (!this.currentXid.equals(xid)) {
+                throw new XAException("Invalid Xid: expected " + this.currentXid + ", but
was " + xid);
+            }
 
             try {
                 connection.rollback();

Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/ManagedDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/ManagedDataSource.java?rev=1571755&r1=1571754&r2=1571755&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/ManagedDataSource.java
(original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/ManagedDataSource.java
Tue Feb 25 17:24:40 2014
@@ -58,16 +58,24 @@ public class ManagedDataSource<C extends
      * used to create the pool
      */
     public void setTransactionRegistry(TransactionRegistry transactionRegistry) {
-        if(this.transactionRegistry != null) throw new IllegalStateException("TransactionRegistry
already set");
-        if(transactionRegistry == null) throw new NullPointerException("TransactionRegistry
is null");
+        if(this.transactionRegistry != null) {
+            throw new IllegalStateException("TransactionRegistry already set");
+        }
+        if(transactionRegistry == null) {
+            throw new NullPointerException("TransactionRegistry is null");
+        }
 
         this.transactionRegistry = transactionRegistry;
     }
 
     @Override
     public Connection getConnection() throws SQLException {
-        if (getPool() == null) throw new IllegalStateException("Pool has not been set");
-        if (transactionRegistry == null) throw new IllegalStateException("TransactionRegistry
has not been set");
+        if (getPool() == null) {
+            throw new IllegalStateException("Pool has not been set");
+        }
+        if (transactionRegistry == null) {
+            throw new IllegalStateException("TransactionRegistry has not been set");
+        }
 
         Connection connection = new ManagedConnection<>(getPool(), transactionRegistry,
isAccessToUnderlyingConnectionAllowed());
         return connection;

Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/TransactionContext.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/TransactionContext.java?rev=1571755&r1=1571754&r2=1571755&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/TransactionContext.java
(original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/TransactionContext.java
Tue Feb 25 17:24:40 2014
@@ -51,8 +51,12 @@ public class TransactionContext {
      * @param transaction the transaction
      */
     public TransactionContext(TransactionRegistry transactionRegistry, Transaction transaction)
{
-        if (transactionRegistry == null) throw new NullPointerException("transactionRegistry
is null");
-        if (transaction == null) throw new NullPointerException("transaction is null");
+        if (transactionRegistry == null) {
+            throw new NullPointerException("transactionRegistry is null");
+        }
+        if (transaction == null) {
+            throw new NullPointerException("transaction is null");
+        }
         this.transactionRegistry = transactionRegistry;
         this.transactionRef = new WeakReference<>(transaction);
     }

Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/TransactionRegistry.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/TransactionRegistry.java?rev=1571755&r1=1571754&r2=1571755&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/TransactionRegistry.java
(original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/managed/TransactionRegistry.java
Tue Feb 25 17:24:40 2014
@@ -63,8 +63,12 @@ public class TransactionRegistry {
      * @param xaResource the XAResource which managed the connection within a transaction
      */
     public synchronized void registerConnection(Connection connection, XAResource xaResource)
{
-        if (connection == null) throw new NullPointerException("connection is null");
-        if (xaResource == null) throw new NullPointerException("xaResource is null");
+        if (connection == null) {
+            throw new NullPointerException("connection is null");
+        }
+        if (xaResource == null) {
+            throw new NullPointerException("xaResource is null");
+        }
         xaResources.put(connection, xaResource);
     }
 
@@ -75,7 +79,9 @@ public class TransactionRegistry {
      * @throws SQLException if the connection does not have a registered XAResource
      */
     public synchronized XAResource getXAResource(Connection connection) throws SQLException
{
-        if (connection == null) throw new NullPointerException("connection is null");
+        if (connection == null) {
+            throw new NullPointerException("connection is null");
+        }
         Connection key = getConnectionKey(connection);
         XAResource xaResource = xaResources.get(key);
         if (xaResource == null) {



Mime
View raw message