KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > groovy > syntax > ReadException


1 package org.codehaus.groovy.syntax;
2
3 import org.codehaus.groovy.GroovyException;
4
5 import java.io.IOException JavaDoc;
6
7 /**
8  * Encapsulates non-specific i/o exceptions.
9  */

10
11 public class ReadException extends GroovyException {
12     private IOException JavaDoc cause = null;
13
14     public ReadException(IOException JavaDoc cause) {
15         super();
16         this.cause = cause;
17     }
18
19     public ReadException(String JavaDoc message, IOException JavaDoc cause) {
20         super(message);
21         this.cause = cause;
22     }
23
24     public IOException JavaDoc getIOCause() {
25         return this.cause;
26     }
27
28     public String JavaDoc toString() {
29         String JavaDoc message = super.getMessage();
30         if (message == null || message.trim().equals("")) {
31             message = cause.getMessage();
32         }
33
34         return message;
35     }
36
37     public String JavaDoc getMessage() {
38         return toString();
39     }
40 }
41
Popular Tags