01: package org.codehaus.groovy.syntax;
02:
03: import org.codehaus.groovy.GroovyException;
04:
05: import java.io.IOException;
06:
07: /**
08: * Encapsulates non-specific i/o exceptions.
09: */
10:
11: public class ReadException extends GroovyException {
12: private IOException cause = null;
13:
14: public ReadException(IOException cause) {
15: super ();
16: this .cause = cause;
17: }
18:
19: public ReadException(String message, IOException cause) {
20: super (message);
21: this .cause = cause;
22: }
23:
24: public IOException getIOCause() {
25: return this .cause;
26: }
27:
28: public String toString() {
29: String message = super .getMessage();
30: if (message == null || message.trim().equals("")) {
31: message = cause.getMessage();
32: }
33:
34: return message;
35: }
36:
37: public String getMessage() {
38: return toString();
39: }
40: }
|