From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25102 invoked by alias); 6 Aug 2008 07:51:08 -0000 Received: (qmail 25089 invoked by uid 22791); 6 Aug 2008 07:51:07 -0000 X-Spam-Check-By: sourceware.org Received: from vegas.theobroma-systems.com (HELO mail.theobroma-systems.com) (88.198.52.168) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 06 Aug 2008 07:50:28 +0000 Received: from [86.59.122.178] (port=53455 helo=[10.0.2.106]) by mail.theobroma-systems.com with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1KQdmk-00019D-HY for mauve-patches@sourceware.org; Wed, 06 Aug 2008 09:50:20 +0200 Subject: closing files after parsing the tags From: Christian Thalinger To: mauve-patches ml Content-Type: text/plain Date: Wed, 06 Aug 2008 07:51:00 -0000 Message-Id: <1218009017.16483.3.camel@cthalinger> Mime-Version: 1.0 X-Mailer: Evolution 2.22.1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact mauve-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-patches-owner@sourceware.org X-SW-Source: 2008/txt/msg00056.txt.bz2 Hi! I had some problems with "Too many open files" during my nightly tests and the reason was, I forgot to close the files after parsing. Here is the patch. - twisti --- Index: Harness.java =================================================================== RCS file: /cvs/mauve/mauve/Harness.java,v retrieving revision 1.30 diff -u -3 -p -r1.30 Harness.java --- Harness.java 25 Jun 2008 14:51:50 -0000 1.30 +++ Harness.java 6 Aug 2008 07:44:30 -0000 @@ -965,9 +965,10 @@ public class Harness String base = f.getAbsolutePath(); base = base.substring(0, base.lastIndexOf(File.separatorChar)); + BufferedReader r = null; try { - BufferedReader r = new BufferedReader(new FileReader(f)); + r = new BufferedReader(new FileReader(f)); String line = null; line = r.readLine(); while (line != null) @@ -1006,6 +1007,19 @@ public class Harness ioe.printStackTrace(); return false; } + finally + { + try + { + r.close(); + } + catch (IOException ioe) + { + // This shouldn't happen. + ioe.printStackTrace(); + return false; + } + } return true; }