summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.iplog
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2010-06-13 03:28:04 +0200
committerRobin Rosenberg <robin.rosenberg@dewire.com>2010-06-13 03:28:04 +0200
commite7c9db836bb3b7b33f3e7894c0a3de6f9aeab621 (patch)
treee977475fdd13d62259636d23b277b1d17056fa56 /org.eclipse.jgit.iplog
parentf396326e0b6c41b92fefb946b943aa82c603a3a6 (diff)
downloadjgit-e7c9db836bb3b7b33f3e7894c0a3de6f9aeab621.tar.gz
jgit-e7c9db836bb3b7b33f3e7894c0a3de6f9aeab621.zip
Make sure a Stream is closed upon errors in IpLogGenerator
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Diffstat (limited to 'org.eclipse.jgit.iplog')
-rw-r--r--org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java60
1 files changed, 32 insertions, 28 deletions
diff --git a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java
index 28df8b7f53..f64c329847 100644
--- a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java
+++ b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java
@@ -236,36 +236,40 @@ public class IpLogGenerator {
SimpleDateFormat dt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
File list = new File(repo.getDirectory(), "gerrit_committers");
BufferedReader br = new BufferedReader(new FileReader(list));
- String line;
-
- while ((line = br.readLine()) != null) {
- String[] field = line.trim().split(" *\\| *");
- String user = field[1];
- String name = field[2];
- String email = field[3];
- Date begin = parseDate(dt, field[4]);
- Date end = parseDate(dt, field[5]);
-
- if (user.startsWith("username:"))
- user = user.substring("username:".length());
-
- Committer who = committersById.get(user);
- if (who == null) {
- who = new Committer(user);
- int sp = name.indexOf(' ');
- if (0 < sp) {
- who.setFirstName(name.substring(0, sp).trim());
- who.setLastName(name.substring(sp + 1).trim());
- } else {
- who.setFirstName(name);
- who.setLastName(null);
+ try {
+ String line;
+
+ while ((line = br.readLine()) != null) {
+ String[] field = line.trim().split(" *\\| *");
+ String user = field[1];
+ String name = field[2];
+ String email = field[3];
+ Date begin = parseDate(dt, field[4]);
+ Date end = parseDate(dt, field[5]);
+
+ if (user.startsWith("username:"))
+ user = user.substring("username:".length());
+
+ Committer who = committersById.get(user);
+ if (who == null) {
+ who = new Committer(user);
+ int sp = name.indexOf(' ');
+ if (0 < sp) {
+ who.setFirstName(name.substring(0, sp).trim());
+ who.setLastName(name.substring(sp + 1).trim());
+ } else {
+ who.setFirstName(name);
+ who.setLastName(null);
+ }
+ committersById.put(who.getID(), who);
}
- committersById.put(who.getID(), who);
- }
- who.addEmailAddress(email);
- who.addActiveRange(new ActiveRange(begin, end));
- committersByEmail.put(email, who);
+ who.addEmailAddress(email);
+ who.addActiveRange(new ActiveRange(begin, end));
+ committersByEmail.put(email, who);
+ }
+ } finally {
+ br.close();
}
}