You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by kr...@apache.org on 2012/03/09 09:08:02 UTC
svn commit: r1298740 - in /db/derby/code/branches/10.7: ./
java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
Author: kristwaa
Date: Fri Mar 9 08:08:02 2012
New Revision: 1298740
URL: http://svn.apache.org/viewvc?rev=1298740&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.7/ (props changed)
db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
Propchange: db/derby/code/branches/10.7/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Mar 9 08:08:02 2012
@@ -1,2 +1,2 @@
/db/derby/code/branches/10.8:1209227-1209228,1209284
-/db/derby/code/trunk:1035603,1036769,1038514,1038813,1039084,1039268,1040658,1041338,1043227,1043389,1044096,1051026,1053724,1055169,1059888,1060480,1062096,1063809,1065061,1066290,1067250,1067357,1069661,1071463,1071886,1076335,1076387,1078461,1078608,1078693,1081072,1081455,1081568,1085078,1091000,1097247,1103681,1103718,1128243,1129136,1130632,1130895,1131272,1132664,1136363,1138341,1138444,1139449,1141924,1164370,1203050,1207729,1208775,1209228,1243878,1293494
+/db/derby/code/trunk:1035603,1036769,1038514,1038813,1039084,1039268,1040658,1041338,1043227,1043389,1044096,1051026,1053724,1055169,1059888,1060480,1062096,1063809,1065061,1066290,1067250,1067357,1069661,1071463,1071886,1076335,1076387,1078461,1078608,1078693,1081072,1081455,1081568,1085078,1091000,1097247,1103681,1103718,1128243,1129136,1130632,1130895,1131272,1132664,1136363,1138341,1138444,1139449,1141924,1164370,1203050,1207729,1208775,1209228,1243878,1293494,1294512
Modified: db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java?rev=1298740&r1=1298739&r2=1298740&view=diff
==============================================================================
--- db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java (original)
+++ db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java Fri Mar 9 08:08:02 2012
@@ -3196,8 +3196,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 ();
@@ -3211,18 +3209,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;
+ }
}
}
}
@@ -3271,7 +3276,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();
}