01: /*
02: LoaderGenerator - tool for generated xml, sql and doml file needed for Octopus.
03:
04:
05: Copyright (C) 2003 Together
06:
07: This library is free software; you can redistribute it and/or
08: modify it under the terms of the GNU Lesser General Public
09: License as published by the Free Software Foundation; either
10: version 2.1 of the License, or (at your option) any later version.
11:
12: This library is distributed in the hope that it will be useful,
13: but WITHOUT ANY WARRANTY; without even the implied warranty of
14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: Lesser General Public License for more details.
16:
17: You should have received a copy of the GNU Lesser General Public
18: License along with this library; if not, write to the Free Software
19: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20: */
21:
22: package org.webdocwf.util.loader.wizard;
23:
24: import java.io.BufferedReader;
25: import java.io.PrintStream;
26: import java.io.IOException;
27:
28: /**
29: * This thread is used for reading error messages occured while executing process.
30: */
31: public class ErrorReader extends Thread {
32: BufferedReader er;
33: boolean trace = false;
34:
35: /**
36: * Constructor.
37: *
38: * @param bufferedReader buffer reading that reads error messages.
39: */
40: public ErrorReader(BufferedReader bufferedReader) {
41: er = bufferedReader;
42: }
43:
44: /**
45: * Constructor.
46: *
47: * @param bufferedReader buffer reading that reads error messages.
48: * @param trace shows error messages trace.
49: */
50: public ErrorReader(BufferedReader bufferedReader, boolean trace) {
51: er = bufferedReader;
52: this .trace = trace;
53: }
54:
55: /**
56: * Run the thread
57: */
58: public void run() {
59: try {
60: for (; !er.ready(); Thread.sleep(100L)) {
61: }
62: String s;
63: while ((s = er.readLine()) != null) {
64: if (trace)
65: System.out.println(s + "\n");
66: }
67: } catch (IOException e) {
68: } catch (InterruptedException e) {
69: }
70: }
71: }
|