diff src/org/tmatesoft/hg/repo/HgBranches.java @ 348:a0864b2892cd

Expose errors reading mercurial control files with exception
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 24 Nov 2011 02:57:03 +0100
parents a54bfe0db959
children 5f9073eabf06
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgBranches.java	Tue Nov 22 05:25:57 2011 +0100
+++ b/src/org/tmatesoft/hg/repo/HgBranches.java	Thu Nov 24 02:57:03 2011 +0100
@@ -54,7 +54,7 @@
 		repo = hgRepo;
 	}
 
-	private int readCache() /*XXX throws parse errors, e.g. may fail with NumberFormatException */{
+	private int readCache() {
 		File branchheadsCache = getCacheFile();
 		int lastInCache = -1;
 		if (!branchheadsCache.canRead()) {
@@ -97,7 +97,12 @@
 			}
 			return lastInCache;
 		} catch (IOException ex) {
-			repo.getContext().getLog().warn(getClass(), ex, null); // log error, but otherwise do nothing
+			 // log error, but otherwise do nothing
+			repo.getContext().getLog().warn(getClass(), ex, null);
+			// FALL THROUGH to return -1 indicating no cache information 
+		} catch (NumberFormatException ex) {
+			repo.getContext().getLog().warn(getClass(), ex, null);
+			// FALL THROUGH
 		} finally {
 			if (br != null) {
 				try {