public GitChangeSetList parse(AbstractBuild build, File changelogFile) throws IOException, SAXException { ArrayList<GitChangeSet> r = new ArrayList<GitChangeSet>(); // Parse the log file into GitChangeSet items - each one is a commit BufferedReader rdr = new BufferedReader(new FileReader(changelogFile)); try { String line; // We use the null value to determine whether at least one commit was // present in the changelog. If it stays null, there is no commit line. List<String> lines = null; while ((line = rdr.readLine()) != null) { if (line.startsWith("commit ")) { if (lines != null) { r.add(parseCommit(lines, authorOrCommitter)); } lines = new ArrayList<String>(); } if (lines != null) { lines.add(line); } } if (lines != null) { r.add(parseCommit(lines, authorOrCommitter)); } return new GitChangeSetList(build, r); } finally { rdr.close(); } }
return new GitChangeSetList(build, r); } finally { rdr.close();
@Override public GitChangeSetList parse(Run build, RepositoryBrowser<?> browser, File changelogFile) throws IOException, SAXException { // Parse the log file into GitChangeSet items - each one is a commit LineIterator lineIterator = null; try { lineIterator = FileUtils.lineIterator(changelogFile,"UTF-8"); return new GitChangeSetList(build, browser, parse(lineIterator)); } finally { LineIterator.closeQuietly(lineIterator); } }