db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r1298743 - in /db/derby/code/branches/10.6: ./ java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
Date Fri, 09 Mar 2012 08:19:37 GMT
Author: kristwaa
Date: Fri Mar  9 08:19:37 2012
New Revision: 1298743

URL: http://svn.apache.org/viewvc?rev=1298743&view=rev
Log:
DERBY-5603: EmbedConnection.clearLOBMapping() incorrectly clears lobFiles causing a ConcurrentModificationException

Merged fix from trunk (revision 1294512).

Modified:
    db/derby/code/branches/10.6/   (props changed)
    db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java

Propchange: db/derby/code/branches/10.6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Mar  9 08:19:37 2012
@@ -1,4 +1,4 @@
 /db/derby/code/branches/10.7:1140196,1294731
 /db/derby/code/branches/10.8:1209227-1209228,1209284
-/db/derby/code/trunk:938547,938796,938959,939231,940462,940469,941627,942031,942286,942476,942480,942587,944152,946794,948045,948069,951346,951366,952138,952237,952581,954344,954421,954544,954748,955001,955540,955634,956075,956234,956445,956569,956659,957260,957902,958163,958257,958264,958508,958522,958555,958618,958939,959550,961892,962716,963206,963705,964039,964115,964402,965647,966393,967201,967304,980089,980684,986689,986834,987539,989099,990292,997325,998170,999119,999479,999485,1002291,1002682,1002853,1021426,1024511,1024528,1025615,1025795,1028716,1030043,1033485,1033864,1035164,1038514,1040658,1053724,1055169,1062096,1063809,1065061,1067250,1069661,1071886,1078461,1081455,1097247,1103681,1103718,1136363,1138341,1138444,1141924,1164370,1203050,1207729,1208775,1293494
+/db/derby/code/trunk:938547,938796,938959,939231,940462,940469,941627,942031,942286,942476,942480,942587,944152,946794,948045,948069,951346,951366,952138,952237,952581,954344,954421,954544,954748,955001,955540,955634,956075,956234,956445,956569,956659,957260,957902,958163,958257,958264,958508,958522,958555,958618,958939,959550,961892,962716,963206,963705,964039,964115,964402,965647,966393,967201,967304,980089,980684,986689,986834,987539,989099,990292,997325,998170,999119,999479,999485,1002291,1002682,1002853,1021426,1024511,1024528,1025615,1025795,1028716,1030043,1033485,1033864,1035164,1038514,1040658,1053724,1055169,1062096,1063809,1065061,1067250,1069661,1071886,1078461,1081455,1097247,1103681,1103718,1136363,1138341,1138444,1141924,1164370,1203050,1207729,1208775,1293494,1294512
 /db/derby/docs/trunk:954344

Modified: db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java?rev=1298743&r1=1298742&r2=1298743&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
(original)
+++ db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
Fri Mar  9 08:19:37 2012
@@ -3166,8 +3166,6 @@ public abstract class EmbedConnection im
 	public void clearLOBMapping() throws SQLException {
 
 		//free all the lob resources in the HashMap
-		//initialize the locator value to 0 and
-		//the hash table object to null.
 		Map map = rootConnection.lobReferences;
 		if (map != null) {
             Iterator it = map.keySet ().iterator ();
@@ -3181,18 +3179,25 @@ public abstract class EmbedConnection im
         }
 		
 		synchronized (this) {   
+            // Try a bit harder to close all open files, as open file handles
+            // can cause problems further down the road.
 			if (lobFiles != null) {       
+                SQLException firstException = null;
 				Iterator it = lobFiles.iterator();
-				while (it.hasNext()) {
-					try {
-						((LOBFile) it.next()).close();
-					} catch (IOException ioe) {
-						throw Util.javaException(ioe);
-					}
-					finally {
-						lobFiles.clear();
-					}
-				}
+                while (it.hasNext()) {
+                    try {
+                        ((LOBFile) it.next()).close();
+                    } catch (IOException ioe) {
+                        // Discard all exceptions besides the first one.
+                        if (firstException == null) {
+                            firstException = Util.javaException(ioe);
+                        }
+                    }
+                }
+                lobFiles.clear();
+                if (firstException != null) {
+                    throw firstException;
+                }
 			}
 		}
 	}
@@ -3241,7 +3246,7 @@ public abstract class EmbedConnection im
 	* Return the Hash Map in the root connection
 	* @return the HashMap that contains the locator to LOB object mapping
 	*/
-	public HashMap getlobHMObj() {
+	private HashMap getlobHMObj() {
 		if (rootConnection.lobHashMap == null) {
 			rootConnection.lobHashMap = new HashMap();
 		}



Mime
View raw message