01: /*
02: * ParseException.java
03: *
04: * Created on October 8, 2002, 2:54 PM
05: */
06:
07: package org.netbeans.performance.spi;
08:
09: import org.apache.tools.ant.*;
10: import org.apache.tools.ant.types.*;
11: import java.io.File;
12:
13: /** An exception that can be thrown by objects attempting to parse logged
14: * data. Not all parse exceptions could or should be fatal - they may
15: * be used as a mechanism to try a different parser, or can result in
16: * a name-value pair object simply returning its value as undefined.
17: * @author Tim Boudreau
18: */
19: public class ParseException extends DataNotFoundException {
20: String source;
21:
22: /** Creates a new instance of ParseException */
23: public ParseException(String source, String message) {
24: super (message);
25: this .source = source;
26: }
27:
28: public ParseException(String message) {
29: super (message);
30: }
31:
32: /** Creates a new instance of ParseException */
33: public ParseException(String message, File f) {
34: super (message);
35: this .file = f;
36: }
37:
38: public ParseException(String message, File f, Throwable t) {
39: super (message, t);
40: this .file = f;
41: }
42:
43: public ParseException(String message, Throwable t) {
44: super (message, t);
45: }
46:
47: //--------------
48: /** Creates a new instance of ParseException */
49: public ParseException(String message, File f, String source) {
50: super (message);
51: this .file = f;
52: this .source = source;
53: }
54:
55: public ParseException(String message, File f, String source,
56: Throwable t) {
57: super (message, t);
58: this .file = f;
59: this .source = source;
60: }
61:
62: public ParseException(String message, String source, Throwable t) {
63: super (message, t);
64: this .source = source;
65: }
66:
67: public String getSource() {
68: return source;
69: }
70:
71: public String getMessage() {
72: StringBuffer result = new StringBuffer(super .getMessage());
73: if (file != null) {
74: result.append("\nSource: " + source);
75: }
76: return result.toString();
77: }
78:
79: }
|