KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > dods > generator > ErrorReader


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  */

19
20 /*
21  *
22  * @author Nenad Vico
23  * @version 1.0.0 2003/02/26
24  *
25  */

26 package org.enhydra.dods.generator;
27
28 import java.io.BufferedReader JavaDoc;
29 import java.io.IOException JavaDoc;
30
31 /**
32  * This thread is used for reading error messages occured while executing process.
33  */

34 public class ErrorReader extends Thread JavaDoc {
35     BufferedReader JavaDoc er;
36     boolean trace = false;
37
38     /**
39      * Constructor.
40      *
41      * @param bufferedReader buffer reading that reads error messages.
42      */

43     public ErrorReader(BufferedReader JavaDoc bufferedReader) {
44         er = bufferedReader;
45     }
46
47     /**
48      * Constructor.
49      *
50      * @param bufferedReader buffer reading that reads error messages.
51      * @param trace dialog that shows error messages.
52      */

53     public ErrorReader(BufferedReader JavaDoc bufferedReader, boolean trace) {
54         er = bufferedReader;
55         this.trace = trace;
56     }
57
58     public void run() {
59         try {
60             for (; !er.ready(); Thread.sleep(100L)) {}
61             String JavaDoc s;
62
63             while ((s = er.readLine()) != null) {
64                 if (trace) {
65                     System.out.println(s + "\n");
66                 }
67             }
68         } catch (IOException JavaDoc e) {} catch (InterruptedException JavaDoc e) {}
69     }
70 }
71
Popular Tags