annotate src/org/tmatesoft/hg/internal/LineReader.java @ 632:54e16ab771ec v1.1rc2

Progress/cancel for HgDiffCommand. Renamed execute method
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 30 May 2013 16:13:43 +0200
parents 6526d8adbc0f
children e79cf9a8130b
rev   line source
480
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
1 /*
539
9edfd5a223b8 Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 483
diff changeset
2 * Copyright (c) 2012-2013 TMate Software Ltd
480
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
3 *
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
6 * the Free Software Foundation; version 2 of the License.
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
7 *
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
8 * This program is distributed in the hope that it will be useful,
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
11 * GNU General Public License for more details.
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
12 *
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
13 * For information on how to redistribute this software under
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
14 * the terms of a license other than GNU General Public License
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
15 * contact TMate Software at support@hg4j.com
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
16 */
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
17 package org.tmatesoft.hg.internal;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
18
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
19 import java.io.BufferedReader;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
20 import java.io.File;
539
9edfd5a223b8 Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 483
diff changeset
21 import java.io.FileInputStream;
480
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
22 import java.io.FileReader;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
23 import java.io.IOException;
539
9edfd5a223b8 Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 483
diff changeset
24 import java.io.InputStreamReader;
9edfd5a223b8 Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 483
diff changeset
25 import java.io.Reader;
9edfd5a223b8 Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 483
diff changeset
26 import java.nio.charset.Charset;
480
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
27 import java.util.Collection;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
28
628
6526d8adbc0f Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 624
diff changeset
29 import org.tmatesoft.hg.core.HgIOException;
480
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
30 import org.tmatesoft.hg.util.LogFacility;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
31
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
32 /**
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
33 * Handy class to read line-based configuration files
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
34 *
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
35 * @author Artem Tikhomirov
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
36 * @author TMate Software Ltd.
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
37 */
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
38 public final class LineReader {
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
39
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
40 public interface LineConsumer<T> {
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
41 // boolean begin(File f, T paramObj) throws IOException;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
42 boolean consume(String line, T paramObj) throws IOException;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
43 // boolean end(File f, T paramObj) throws IOException;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
44 }
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
45
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
46 public static class SimpleLineCollector implements LineReader.LineConsumer<Collection<String>> {
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
47
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
48 public boolean consume(String line, Collection<String> result) throws IOException {
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
49 result.add(line);
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
50 return true;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
51 }
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
52 }
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
53
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
54 private final File file;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
55 private final LogFacility log;
539
9edfd5a223b8 Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 483
diff changeset
56 private final Charset encoding;
480
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
57 private boolean trimLines = true;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
58 private boolean skipEmpty = true;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
59 private String ignoreThatStarts = null;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
60
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
61 public LineReader(File f, LogFacility logFacility) {
539
9edfd5a223b8 Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 483
diff changeset
62 this(f, logFacility, null);
9edfd5a223b8 Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 483
diff changeset
63 }
9edfd5a223b8 Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 483
diff changeset
64
9edfd5a223b8 Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 483
diff changeset
65 public LineReader(File f, LogFacility logFacility, Charset lineEncoding) {
480
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
66 file = f;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
67 log = logFacility;
539
9edfd5a223b8 Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 483
diff changeset
68 encoding = lineEncoding;
480
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
69 }
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
70
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
71 /**
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
72 * default: <code>true</code>
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
73 * <code>false</code> to return line as is
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
74 */
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
75 public LineReader trimLines(boolean trim) {
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
76 trimLines = trim;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
77 return this;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
78 }
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
79
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
80 /**
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
81 * default: <code>true</code>
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
82 * <code>false</code> to pass empty lines to consumer
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
83 */
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
84 public LineReader skipEmpty(boolean skip) {
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
85 skipEmpty = skip;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
86 return this;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
87 }
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
88
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
89 /**
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
90 * default: doesn't skip any line.
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
91 * set e.g. to "#" or "//" to skip lines that start with such prefix
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
92 */
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
93 public LineReader ignoreLineComments(String lineStart) {
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
94 ignoreThatStarts = lineStart;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
95 return this;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
96 }
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
97
628
6526d8adbc0f Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 624
diff changeset
98 public <T> void read(LineConsumer<T> consumer, T paramObj) throws HgIOException {
480
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
99 BufferedReader statusFileReader = null;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
100 try {
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
101 // consumer.begin(file, paramObj);
539
9edfd5a223b8 Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 483
diff changeset
102 Reader fileReader;
9edfd5a223b8 Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 483
diff changeset
103 if (encoding == null) {
9edfd5a223b8 Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 483
diff changeset
104 fileReader = new FileReader(file);
9edfd5a223b8 Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 483
diff changeset
105 } else {
590
8cbc2a883d95 Use requested encoding in LineReader
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 539
diff changeset
106 fileReader = new InputStreamReader(new FileInputStream(file), encoding);
539
9edfd5a223b8 Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 483
diff changeset
107 }
9edfd5a223b8 Commit: handle empty repository case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 483
diff changeset
108 statusFileReader = new BufferedReader(fileReader);
480
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
109 String line;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
110 boolean ok = true;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
111 while (ok && (line = statusFileReader.readLine()) != null) {
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
112 if (trimLines) {
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
113 line = line.trim();
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
114 }
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
115 if (ignoreThatStarts != null && line.startsWith(ignoreThatStarts)) {
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
116 continue;
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
117 }
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
118 if (!skipEmpty || line.length() > 0) {
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
119 ok = consumer.consume(line, paramObj);
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
120 }
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
121 }
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
122 } catch (IOException ex) {
628
6526d8adbc0f Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 624
diff changeset
123 throw new HgIOException(ex.getMessage(), ex, file);
480
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
124 } finally {
624
507602cb4fb3 FIXMEs and TODOs: pay some technical debt
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 590
diff changeset
125 new FileUtils(log).closeQuietly(statusFileReader);
480
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
126 // try {
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
127 // consumer.end(file, paramObj);
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
128 // } catch (IOException ex) {
624
507602cb4fb3 FIXMEs and TODOs: pay some technical debt
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 590
diff changeset
129 // log.warn(getClass(), ex, null);
480
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
130 // }
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
131 }
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
132 }
f3fab7a20841 Refactor LineReader utility as stanalone class to facilitate reuse
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
133 }