|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ExceptionMessage.java | 0% | 0% | 0% | 0% |
|
1 |
package org.codehaus.groovy.control.messages;
|
|
2 |
|
|
3 |
import java.io.PrintWriter;
|
|
4 |
|
|
5 |
import org.codehaus.groovy.control.Janitor;
|
|
6 |
import org.codehaus.groovy.control.ProcessingUnit;
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
/**
|
|
11 |
* A class for error messages produced by the parser system.
|
|
12 |
*
|
|
13 |
* @author <a href="mailto:cpoirier@dreaming.org">Chris Poirier</a>
|
|
14 |
*
|
|
15 |
* @version $Id: ExceptionMessage.java,v 1.2 2004/07/10 03:31:41 bran Exp $
|
|
16 |
*/
|
|
17 |
|
|
18 |
public class ExceptionMessage extends Message |
|
19 |
{ |
|
20 |
private Exception cause = null; // The exception source of the message, if any |
|
21 |
|
|
22 |
|
|
23 | 0 |
public ExceptionMessage( Exception cause )
|
24 |
{ |
|
25 | 0 |
this.cause = cause;
|
26 |
} |
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
/**
|
|
31 |
* Returns the underlying Exception.
|
|
32 |
*/
|
|
33 |
|
|
34 | 0 |
public Exception getCause()
|
35 |
{ |
|
36 | 0 |
return this.cause; |
37 |
} |
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
/**
|
|
42 |
* Writes out a nicely formatted summary of the exception.
|
|
43 |
*/
|
|
44 |
|
|
45 | 0 |
public void write( PrintWriter output, ProcessingUnit context, Janitor janitor ) |
46 |
{ |
|
47 | 0 |
String description = "General error during " + context.getPhaseDescription() + ": "; |
48 |
|
|
49 | 0 |
String message = cause.getMessage(); |
50 | 0 |
if( message != null ) |
51 |
{ |
|
52 | 0 |
output.println( description + message ); |
53 |
} |
|
54 |
else
|
|
55 |
{ |
|
56 | 0 |
output.println( description + cause ); |
57 |
} |
|
58 | 0 |
output.println("");
|
59 |
} |
|
60 |
|
|
61 |
|
|
62 |
} |
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|