comparison 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
comparison
equal deleted inserted replaced
347:8da7ade36c57 348:a0864b2892cd
52 52
53 HgBranches(HgRepository hgRepo) { 53 HgBranches(HgRepository hgRepo) {
54 repo = hgRepo; 54 repo = hgRepo;
55 } 55 }
56 56
57 private int readCache() /*XXX throws parse errors, e.g. may fail with NumberFormatException */{ 57 private int readCache() {
58 File branchheadsCache = getCacheFile(); 58 File branchheadsCache = getCacheFile();
59 int lastInCache = -1; 59 int lastInCache = -1;
60 if (!branchheadsCache.canRead()) { 60 if (!branchheadsCache.canRead()) {
61 return lastInCache; 61 return lastInCache;
62 } 62 }
95 BranchInfo bi = new BranchInfo(e.getKey(), heads); 95 BranchInfo bi = new BranchInfo(e.getKey(), heads);
96 branches.put(e.getKey(), bi); 96 branches.put(e.getKey(), bi);
97 } 97 }
98 return lastInCache; 98 return lastInCache;
99 } catch (IOException ex) { 99 } catch (IOException ex) {
100 repo.getContext().getLog().warn(getClass(), ex, null); // log error, but otherwise do nothing 100 // log error, but otherwise do nothing
101 repo.getContext().getLog().warn(getClass(), ex, null);
102 // FALL THROUGH to return -1 indicating no cache information
103 } catch (NumberFormatException ex) {
104 repo.getContext().getLog().warn(getClass(), ex, null);
105 // FALL THROUGH
101 } finally { 106 } finally {
102 if (br != null) { 107 if (br != null) {
103 try { 108 try {
104 br.close(); 109 br.close();
105 } catch (IOException ex) { 110 } catch (IOException ex) {