1 package org.codehaus.groovy.syntax;
2
3 import org.codehaus.groovy.GroovyException;
4 import java.io.IOException;
5
6 /***
7 * Encapsulates non-specific i/o exceptions.
8 */
9
10 public class ReadException extends GroovyException
11 {
12 private IOException cause = null;
13
14 public ReadException( IOException cause )
15 {
16 super();
17 this.cause = cause;
18 }
19
20 public ReadException( String message, IOException cause )
21 {
22 super( message );
23 this.cause = cause;
24 }
25
26 public IOException getIOCause()
27 {
28 return this.cause;
29 }
30
31 public String toString()
32 {
33 String message = super.getMessage();
34 if( message == null || message.trim() == "" )
35 {
36 message = cause.getMessage();
37 }
38
39 return message;
40 }
41
42 public String getMessage()
43 {
44 return toString();
45 }
46 }