Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/HgBranches.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 | 4b661efb9374 |
children | 3f40262153a4 |
comparison
equal
deleted
inserted
replaced
294:32890bab7209 | 295:981f9f50bb6c |
---|---|
87 BranchInfo bi = new BranchInfo(branchName, branchHeads); | 87 BranchInfo bi = new BranchInfo(branchName, branchHeads); |
88 branches.put(branchName, bi); | 88 branches.put(branchName, bi); |
89 } | 89 } |
90 return lastInCache; | 90 return lastInCache; |
91 } catch (IOException ex) { | 91 } catch (IOException ex) { |
92 ex.printStackTrace(); // XXX log error, but otherwise do nothing | 92 repo.getContext().getLog().warn(getClass(), ex, null); // log error, but otherwise do nothing |
93 } finally { | 93 } finally { |
94 if (br != null) { | 94 if (br != null) { |
95 try { | 95 try { |
96 br.close(); | 96 br.close(); |
97 } catch (IOException ex) { | 97 } catch (IOException ex) { |
98 ex.printStackTrace(); // ignore | 98 repo.getContext().getLog().info(getClass(), ex, null); // ignore |
99 } | 99 } |
100 } | 100 } |
101 } | 101 } |
102 return -1; // deliberately not lastInCache, to avoid anything but -1 when 1st line was read and there's error is in lines 2..end | 102 return -1; // deliberately not lastInCache, to avoid anything but -1 when 1st line was read and there's error is in lines 2..end |
103 } | 103 } |
281 bw.write(bi.getName()); | 281 bw.write(bi.getName()); |
282 bw.write("\n"); | 282 bw.write("\n"); |
283 } | 283 } |
284 } | 284 } |
285 bw.close(); | 285 bw.close(); |
286 } catch (IOException e) { | 286 } catch (IOException ex) { |
287 // TODO Auto-generated catch block | 287 repo.getContext().getLog().error(getClass(), ex, "Error writing branch cache file"); |
288 e.printStackTrace(); | |
289 } | 288 } |
290 } | 289 } |
291 | 290 |
292 private File getCacheFile() { | 291 private File getCacheFile() { |
293 // prior to 1.8 used to be .hg/branchheads.cache | 292 // prior to 1.8 used to be .hg/branchheads.cache |