jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1783518 - /jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java
Date Sat, 18 Feb 2017 11:35:11 GMT
Author: fschumacher
Date: Sat Feb 18 11:35:11 2017
New Revision: 1783518

URL: http://svn.apache.org/viewvc?rev=1783518&view=rev
Log:
Remove null check, as dsc can't be null here.

Modified:
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java

Modified: jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java?rev=1783518&r1=1783517&r2=1783518&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java
(original)
+++ jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java
Sat Feb 18 11:35:11 2017
@@ -274,8 +274,8 @@ public class DataSourceElement extends A
          * @throws SQLException if database access error occurrs
          */
         public Connection getConnection() throws SQLException {
-            Connection conn = null;
-            BasicDataSource dsc = null;
+            Connection conn;
+            BasicDataSource dsc;
             if (sharedDSC != null){ // i.e. shared pool
                 dsc = sharedDSC;
             } else {
@@ -288,21 +288,21 @@ public class DataSourceElement extends A
                     perThreadPoolSet.add(dsc);
                 }
             }
-            if (dsc != null) {
-                conn=dsc.getConnection();
-                int transactionIsolation = DataSourceElementBeanInfo.getTransactionIsolationMode(getTransactionIsolation());
-                if (transactionIsolation >= 0 && conn.getTransactionIsolation()
!= transactionIsolation) {
-                    try {
-                        // make sure setting the new isolation mode is done in an auto committed
transaction
-                        conn.setTransactionIsolation(transactionIsolation);
-                        log.debug("Setting transaction isolation: {}@{}",
-                                    transactionIsolation, System.identityHashCode(dsc));
-                    } catch (SQLException ex) {
-                        log.error("Could not set transaction isolation: {}@{}", 
-                                transactionIsolation, System.identityHashCode(dsc));
-                    }   
-                }
+
+            conn=dsc.getConnection();
+            int transactionIsolation = DataSourceElementBeanInfo.getTransactionIsolationMode(getTransactionIsolation());
+            if (transactionIsolation >= 0 && conn.getTransactionIsolation() !=
transactionIsolation) {
+                try {
+                    // make sure setting the new isolation mode is done in an auto committed
transaction
+                    conn.setTransactionIsolation(transactionIsolation);
+                    log.debug("Setting transaction isolation: {}@{}",
+                            transactionIsolation, System.identityHashCode(dsc));
+                } catch (SQLException ex) {
+                    log.error("Could not set transaction isolation: {}@{}", 
+                            transactionIsolation, System.identityHashCode(dsc));
+                }   
             }
+
             return conn;
         }
     }



Mime
View raw message