1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
package org.qedeq.kernel.xml.common; |
19 |
|
|
20 |
|
import org.qedeq.kernel.common.QedeqException; |
21 |
|
import org.qedeq.kernel.common.SourcePosition; |
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
@version |
30 |
|
@author |
31 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 9 |
Complexity Density: 1 |
|
32 |
|
public final class XmlSyntaxException extends QedeqException { |
33 |
|
|
34 |
|
|
35 |
|
public static final int SAX_PARSER_EXCEPTION = 9001; |
36 |
|
|
37 |
|
|
38 |
|
public static final int UNEXPECTED_TAG_CODE = 9002; |
39 |
|
|
40 |
|
|
41 |
|
public static final String UNEXPECTED_TAG_TEXT = "Unexpected tag: "; |
42 |
|
|
43 |
|
|
44 |
|
public static final int UNEXPECTED_DATA_CODE = 9003; |
45 |
|
|
46 |
|
|
47 |
|
public static final String UNEXPECTED_DATA_TEXT = "Unexpected character data in tag: "; |
48 |
|
|
49 |
|
|
50 |
|
public static final int MISSING_ATTRIBUTE_CODE = 9004; |
51 |
|
|
52 |
|
|
53 |
|
public static final String MISSING_ATTRIBUTE_TEXT_1 = "Missing attribute: "; |
54 |
|
|
55 |
|
|
56 |
|
public static final String MISSING_ATTRIBUTE_TEXT_2 = " in tag: "; |
57 |
|
|
58 |
|
|
59 |
|
public static final int EMPTY_ATTRIBUTE_CODE = 9004; |
60 |
|
|
61 |
|
|
62 |
|
public static final String EMPTY_ATTRIBUTE_TEXT_1 = "Missing attribute: "; |
63 |
|
|
64 |
|
|
65 |
|
public static final String EMPTY_ATTRIBUTE_TEXT_2 = " in tag: "; |
66 |
|
|
67 |
|
|
68 |
|
public static final int PROGRAMMING_ERROR_CODE = 9999; |
69 |
|
|
70 |
|
|
71 |
|
public static final String PROGRAMMING_ERROR_TEXT = "A programming error occurred."; |
72 |
|
|
73 |
|
|
74 |
|
private SourcePosition position; |
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
@param |
80 |
|
@param |
81 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
82 |
0
|
private XmlSyntaxException(final int code, final String message) {... |
83 |
0
|
super(code, message); |
84 |
|
} |
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
@param |
90 |
|
@param |
91 |
|
@param |
92 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
93 |
0
|
private XmlSyntaxException(final int code, final String message, final RuntimeException e) {... |
94 |
0
|
super(code, message, e); |
95 |
|
} |
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
@return |
101 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
102 |
0
|
public final SourcePosition getErrorPosition() {... |
103 |
0
|
return position; |
104 |
|
} |
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
@param |
111 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
112 |
0
|
public final void setErrorPosition(final SourcePosition position) {... |
113 |
0
|
this.position = position; |
114 |
|
} |
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
@param |
120 |
|
@return |
121 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
122 |
0
|
public static final XmlSyntaxException createUnexpectedTagException(final String name) {... |
123 |
0
|
return new XmlSyntaxException(UNEXPECTED_TAG_CODE, UNEXPECTED_TAG_TEXT + name); |
124 |
|
} |
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
@param |
130 |
|
@param |
131 |
|
@return |
132 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
133 |
0
|
public static final XmlSyntaxException createUnexpectedTextDataException(final String name,... |
134 |
|
final String value) { |
135 |
0
|
return new XmlSyntaxException(UNEXPECTED_DATA_CODE, UNEXPECTED_DATA_TEXT + name); |
136 |
|
} |
137 |
|
|
138 |
|
|
139 |
|
|
140 |
|
|
141 |
|
@param |
142 |
|
@param |
143 |
|
@return |
144 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
145 |
0
|
public static final XmlSyntaxException createMissingAttributeException(final String name,... |
146 |
|
final String attribute) { |
147 |
0
|
return new XmlSyntaxException(MISSING_ATTRIBUTE_CODE, MISSING_ATTRIBUTE_TEXT_1 + attribute |
148 |
|
+ MISSING_ATTRIBUTE_TEXT_2 + name); |
149 |
|
} |
150 |
|
|
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
@param |
155 |
|
@param |
156 |
|
@return |
157 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
158 |
0
|
public static final XmlSyntaxException createEmptyAttributeException(final String name,... |
159 |
|
final String attribute) { |
160 |
0
|
return new XmlSyntaxException(EMPTY_ATTRIBUTE_CODE, EMPTY_ATTRIBUTE_TEXT_1 + attribute |
161 |
|
+ EMPTY_ATTRIBUTE_TEXT_2 + name); |
162 |
|
} |
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
|
167 |
|
@param |
168 |
|
@return |
169 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
170 |
0
|
public static final XmlSyntaxException createByRuntimeException(final RuntimeException e) {... |
171 |
0
|
return new XmlSyntaxException(PROGRAMMING_ERROR_CODE, PROGRAMMING_ERROR_TEXT, e); |
172 |
|
} |
173 |
|
|
174 |
|
} |