diff src/org/tmatesoft/hg/internal/RequiresFile.java @ 295:981f9f50bb6c

Issue 11: Error log facility. SessionContext to share common facilities
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 16 Sep 2011 05:35:32 +0200
parents ff4fdbab4e2d
children ba36f66c32b4
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/RequiresFile.java	Wed Sep 14 04:41:57 2011 +0200
+++ b/src/org/tmatesoft/hg/internal/RequiresFile.java	Fri Sep 16 05:35:32 2011 +0200
@@ -35,16 +35,17 @@
 	public RequiresFile() {
 	}
 
-	public void parse(Internals repoImpl, File requiresFile) {
+	public void parse(Internals repoImpl, File requiresFile) throws IOException {
 		if (!requiresFile.exists()) {
 			return;
 		}
+		BufferedReader br = null;
 		try {
 			boolean revlogv1 = false;
 			boolean store = false;
 			boolean fncache = false;
 			boolean dotencode = false;
-			BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(requiresFile)));
+			br = new BufferedReader(new InputStreamReader(new FileInputStream(requiresFile)));
 			String line;
 			while ((line = br.readLine()) != null) {
 				revlogv1 |= "revlogv1".equals(line);
@@ -57,9 +58,10 @@
 			flags += fncache ? FNCACHE : 0;
 			flags += dotencode ? DOTENCODE : 0;
 			repoImpl.setStorageConfig(revlogv1 ? 1 : 0, flags);
-			br.close();
-		} catch (IOException ex) {
-			ex.printStackTrace(); // FIXME log
+		} finally {
+			if (br != null) {
+				br.close();
+			}
 		}
 	}
 }