db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r1333305 - /db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java
Date Thu, 03 May 2012 04:24:22 GMT
Author: kristwaa
Date: Thu May  3 04:24:22 2012
New Revision: 1333305

URL: http://svn.apache.org/viewvc?rev=1333305&view=rev
Log:
DERBY-5561: Race conditions in LogicalConnection checking for a null physical connection

Made methods calling checkForNullPhysicalConnection synchronized.

Patch contributed by Brett Bergquist (brett at thebergquistfamily dot com).

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java?rev=1333305&r1=1333304&r2=1333305&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java Thu
May  3 04:24:22 2012
@@ -197,7 +197,7 @@ public class LogicalConnection implement
 		}
     }
 
-    public String nativeSQL(String sql) throws SQLException {
+    synchronized public String nativeSQL(String sql) throws SQLException {
 		try {
 	        checkForNullPhysicalConnection();
 	        return physicalConnection_.nativeSQL(sql);
@@ -217,7 +217,7 @@ public class LogicalConnection implement
 		}
     }
 
-    public boolean getAutoCommit() throws SQLException {
+    synchronized public boolean getAutoCommit() throws SQLException {
 		try {
 	        checkForNullPhysicalConnection();
 	        return physicalConnection_.getAutoCommit();
@@ -257,7 +257,7 @@ public class LogicalConnection implement
 		}
     }
 
-    public int getTransactionIsolation() throws SQLException {
+    synchronized public int getTransactionIsolation() throws SQLException {
 		try {
 	        checkForNullPhysicalConnection();
 	        return physicalConnection_.getTransactionIsolation();
@@ -267,7 +267,7 @@ public class LogicalConnection implement
 		}
     }
 
-    public java.sql.SQLWarning getWarnings() throws SQLException {
+    synchronized public java.sql.SQLWarning getWarnings() throws SQLException {
 		try {
 	        checkForNullPhysicalConnection();
 	        return physicalConnection_.getWarnings();
@@ -363,7 +363,7 @@ public class LogicalConnection implement
 		}
     }
 
-    public boolean isReadOnly() throws SQLException {
+    synchronized public boolean isReadOnly() throws SQLException {
 		try {
 	        checkForNullPhysicalConnection();
 	        return physicalConnection_.isReadOnly();
@@ -383,7 +383,7 @@ public class LogicalConnection implement
 		}
     }
 
-    public String getCatalog() throws SQLException {
+    synchronized public String getCatalog() throws SQLException {
 		try {
 	        checkForNullPhysicalConnection();
 	        return physicalConnection_.getCatalog();
@@ -428,7 +428,7 @@ public class LogicalConnection implement
 		}
     }
 
-    public java.util.Map getTypeMap() throws SQLException {
+    synchronized public java.util.Map getTypeMap() throws SQLException {
 		try {
 	        checkForNullPhysicalConnection();
 	        return physicalConnection_.getTypeMap();
@@ -448,7 +448,7 @@ public class LogicalConnection implement
 		}
     }
 
-    public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency,
+    synchronized public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency,
                                               int resultSetHoldability) throws SQLException
{
 		try {
 	        checkForNullPhysicalConnection();
@@ -459,7 +459,7 @@ public class LogicalConnection implement
 		}
     }
 
-    public java.sql.CallableStatement prepareCall(String sql, int resultSetType,
+    synchronized public java.sql.CallableStatement prepareCall(String sql, int resultSetType,
                                                   int resultSetConcurrency,
                                                   int resultSetHoldability) throws SQLException
{
 		try {
@@ -471,7 +471,7 @@ public class LogicalConnection implement
 		}
     }
 
-    public java.sql.PreparedStatement prepareStatement(String sql, int resultSetType,
+    synchronized public java.sql.PreparedStatement prepareStatement(String sql, int resultSetType,
                                                        int resultSetConcurrency, int resultSetHoldability)
             throws SQLException {
 		try {
@@ -484,7 +484,7 @@ public class LogicalConnection implement
 		}
     }
 
-    public java.sql.PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
+    synchronized public java.sql.PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
             throws SQLException {
 		try {
 	        checkForNullPhysicalConnection();
@@ -495,7 +495,7 @@ public class LogicalConnection implement
 		}
     }
 
-    public java.sql.PreparedStatement prepareStatement(String sql, int columnIndexes[])
+    synchronized public java.sql.PreparedStatement prepareStatement(String sql, int columnIndexes[])
             throws SQLException {
 		try {
 	        checkForNullPhysicalConnection();
@@ -506,7 +506,7 @@ public class LogicalConnection implement
 		}
     }
 
-    public java.sql.PreparedStatement prepareStatement(String sql, String columnNames[])
+    synchronized public java.sql.PreparedStatement prepareStatement(String sql, String columnNames[])
             throws SQLException {
 		try {
 	        checkForNullPhysicalConnection();
@@ -517,7 +517,7 @@ public class LogicalConnection implement
 		}
     }
 
-    public void setHoldability(int holdability) throws SQLException {
+    synchronized public void setHoldability(int holdability) throws SQLException {
 		try {
 	        checkForNullPhysicalConnection();
 	        physicalConnection_.setHoldability(holdability);
@@ -527,7 +527,7 @@ public class LogicalConnection implement
 		}
     }
 
-    public int getHoldability() throws SQLException {
+    synchronized public int getHoldability() throws SQLException {
 		try {
 	        checkForNullPhysicalConnection();
 	        return physicalConnection_.getHoldability();
@@ -537,7 +537,7 @@ public class LogicalConnection implement
 		}
     }
 
-    public java.sql.Savepoint setSavepoint() throws SQLException {
+    synchronized public java.sql.Savepoint setSavepoint() throws SQLException {
 		try {
 	        checkForNullPhysicalConnection();
 	        return physicalConnection_.setSavepoint();
@@ -547,7 +547,7 @@ public class LogicalConnection implement
 		}
     }
 
-    public java.sql.Savepoint setSavepoint(String name) throws SQLException {
+    synchronized public java.sql.Savepoint setSavepoint(String name) throws SQLException
{
 		try {
 	        checkForNullPhysicalConnection();
 	        return physicalConnection_.setSavepoint(name);
@@ -557,7 +557,7 @@ public class LogicalConnection implement
 		}
     }
 
-    public void rollback(java.sql.Savepoint savepoint) throws SQLException {
+    synchronized public void rollback(java.sql.Savepoint savepoint) throws SQLException {
 		try {
 	        checkForNullPhysicalConnection();
 	        physicalConnection_.rollback(savepoint);
@@ -567,7 +567,7 @@ public class LogicalConnection implement
 		}
     }
 
-    public void releaseSavepoint(java.sql.Savepoint savepoint) throws SQLException {
+    synchronized public void releaseSavepoint(java.sql.Savepoint savepoint) throws SQLException
{
 		try {
 	        checkForNullPhysicalConnection();
 	        physicalConnection_.releaseSavepoint(savepoint);
@@ -610,7 +610,7 @@ public class LogicalConnection implement
     /**
      * Get the name of the current schema.
      */
-    public String   getSchema() throws SQLException
+    synchronized public String   getSchema() throws SQLException
 	{
 		try {
 	        checkForNullPhysicalConnection();
@@ -624,7 +624,7 @@ public class LogicalConnection implement
     /**
      * Set the default schema for the Connection.
      */
-    public void   setSchema(  String schemaName ) throws SQLException
+    synchronized public void   setSchema(  String schemaName ) throws SQLException
 	{
 		try {
 	        checkForNullPhysicalConnection();



Mime
View raw message