Return-Path: X-Original-To: apmail-db-derby-commits-archive@www.apache.org Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1AC579994 for ; Fri, 9 Mar 2012 08:20:00 +0000 (UTC) Received: (qmail 8980 invoked by uid 500); 9 Mar 2012 08:20:00 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 8952 invoked by uid 500); 9 Mar 2012 08:19:59 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 8939 invoked by uid 99); 9 Mar 2012 08:19:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Mar 2012 08:19:59 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Mar 2012 08:19:58 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 9BCA5238897A; Fri, 9 Mar 2012 08:19:37 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: derby-commits@db.apache.org From: kristwaa@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120309081937.9BCA5238897A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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(); }