1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sf.jameleon.exception;
20
21 import org.apache.commons.jelly.LocationAware;
22
23 /***
24 * A RuntimeException that is noted as the script failing. The reason behind a RuntimeException
25 * is so that the test can continue of it is supposed to continue
26 */
27 public class JameleonScriptException extends RuntimeException implements LocationAware{
28 private static final long serialVersionUID = 1L;
29
30 protected int lineNumber = -1;
31 protected int columnNumber = -1;
32 protected String scriptFileName;
33 protected String elementTagName;
34
35 public JameleonScriptException(){
36 super();
37 }
38
39 public JameleonScriptException(String errorMsg){
40 super(errorMsg);
41 }
42
43 public JameleonScriptException(Throwable cause){
44 super(cause);
45 }
46
47 public JameleonScriptException(Throwable cause, LocationAware la){
48 super(cause);
49 copyLocationAwareProperties(la);
50 }
51
52 public JameleonScriptException(String errorMsg, Throwable cause){
53 super(errorMsg, cause);
54 }
55
56 public JameleonScriptException(String errorMsg, LocationAware la){
57 super(errorMsg);
58 copyLocationAwareProperties(la);
59 }
60
61 public JameleonScriptException(String errorMsg, Throwable cause, LocationAware la){
62 super(errorMsg, cause);
63 copyLocationAwareProperties(la);
64 }
65
66 protected void copyLocationAwareProperties(LocationAware la){
67 setLineNumber(la.getLineNumber());
68 setColumnNumber(la.getColumnNumber());
69 setFileName(la.getFileName());
70 setElementName(la.getElementName());
71 }
72
73 /***
74 * @return the line number of the tag
75 */
76 public int getLineNumber(){
77 return lineNumber;
78 }
79
80 /***
81 * Sets the line number of the tag
82 */
83 public void setLineNumber(int lineNumber){
84 this.lineNumber = lineNumber;
85 }
86
87 /***
88 * @return the column number of the tag
89 */
90 public int getColumnNumber(){
91 return columnNumber;
92 }
93
94 /***
95 * Sets the column number of the tag
96 */
97 public void setColumnNumber(int columnNumber){
98 this.columnNumber = columnNumber;
99 }
100
101 /***
102 * @return the Jelly file which caused the problem
103 */
104 public String getFileName(){
105 return scriptFileName;
106 }
107
108 /***
109 * Sets the Jelly file which caused the problem
110 */
111 public void setFileName(String fileName){
112 this.scriptFileName = fileName;
113 }
114
115 /***
116 * @return the element name which caused the problem
117 */
118 public String getElementName(){
119 return elementTagName;
120 }
121
122 /***
123 * Sets the element name which caused the problem
124 */
125 public void setElementName(String elementName){
126 this.elementTagName = elementName;
127 }
128
129 }