1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.qedeq.kernel.xml.common; |
17 |
|
|
18 |
|
import java.io.IOException; |
19 |
|
|
20 |
|
import org.qedeq.kernel.se.common.ErrorCodes; |
21 |
|
import org.qedeq.kernel.se.common.QedeqException; |
22 |
|
import org.xml.sax.SAXException; |
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
@author |
31 |
|
|
|
|
| 77.8% |
Uncovered Elements: 4 (18) |
Complexity: 9 |
Complexity Density: 1 |
|
32 |
|
public final class XmlSyntaxException extends QedeqException implements ErrorCodes { |
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 = "XML structure problem. Unexpected tag: "; |
42 |
|
|
43 |
|
|
44 |
|
public static final int UNEXPECTED_DATA_CODE = 9003; |
45 |
|
|
46 |
|
|
47 |
|
public static final String UNEXPECTED_DATA_TEXT = "XML structure problem. 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 = "XML structure problem. Missing neccessary 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 IO_ERROR_CODE = 9900; |
69 |
|
|
70 |
|
|
71 |
|
public static final String IO_ERROR_TEXT = "An IO error occurred."; |
72 |
|
|
73 |
|
|
74 |
|
public static final int SAX_ERROR_CODE = 9910; |
75 |
|
|
76 |
|
|
77 |
|
public static final String SAX_ERROR_TEXT = "A XML syntax error occurred."; |
78 |
|
|
79 |
|
|
80 |
|
public static final int PROGRAMMING_ERROR_CODE = 9999; |
81 |
|
|
82 |
|
|
83 |
|
public static final String PROGRAMMING_ERROR_TEXT = "A programming error occurred."; |
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
@param |
89 |
|
@param |
90 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
91 |
125
|
private XmlSyntaxException(final int code, final String message) {... |
92 |
125
|
super(code, message); |
93 |
|
} |
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
@param |
99 |
|
@param |
100 |
|
@param |
101 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
102 |
1
|
private XmlSyntaxException(final int code, final String message, final Exception e) {... |
103 |
1
|
super(code, message, e); |
104 |
|
} |
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
@param |
110 |
|
@return |
111 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
112 |
122
|
public static final XmlSyntaxException createUnexpectedTagException(... |
113 |
|
final String name) { |
114 |
122
|
return new XmlSyntaxException(UNEXPECTED_TAG_CODE, UNEXPECTED_TAG_TEXT + name); |
115 |
|
} |
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
@param |
121 |
|
@param |
122 |
|
@return |
123 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
124 |
1
|
public static final XmlSyntaxException createUnexpectedTextDataException(... |
125 |
|
final String name, final String value) { |
126 |
1
|
return new XmlSyntaxException(UNEXPECTED_DATA_CODE, UNEXPECTED_DATA_TEXT + name); |
127 |
|
} |
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
|
132 |
|
@param |
133 |
|
@param |
134 |
|
@return |
135 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
136 |
1
|
public static final XmlSyntaxException createMissingAttributeException(... |
137 |
|
final String name, |
138 |
|
final String attribute) { |
139 |
1
|
return new XmlSyntaxException(MISSING_ATTRIBUTE_CODE, MISSING_ATTRIBUTE_TEXT_1 + attribute |
140 |
|
+ MISSING_ATTRIBUTE_TEXT_2 + name); |
141 |
|
} |
142 |
|
|
143 |
|
|
144 |
|
|
145 |
|
|
146 |
|
@param |
147 |
|
@param |
148 |
|
@return |
149 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
150 |
1
|
public static final XmlSyntaxException createEmptyAttributeException(... |
151 |
|
final String name, final String attribute) { |
152 |
1
|
return new XmlSyntaxException(EMPTY_ATTRIBUTE_CODE, EMPTY_ATTRIBUTE_TEXT_1 + attribute |
153 |
|
+ EMPTY_ATTRIBUTE_TEXT_2 + name); |
154 |
|
} |
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
|
159 |
|
@param |
160 |
|
@return |
161 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
162 |
0
|
public static final XmlSyntaxException createByIOException(... |
163 |
|
final IOException e) { |
164 |
0
|
return new XmlSyntaxException(IO_ERROR_CODE, IO_ERROR_TEXT, e); |
165 |
|
} |
166 |
|
|
167 |
|
|
168 |
|
|
169 |
|
|
170 |
|
@param |
171 |
|
@return |
172 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
173 |
0
|
public static final XmlSyntaxException createBySAXException(... |
174 |
|
final SAXException e) { |
175 |
0
|
return new XmlSyntaxException(SAX_ERROR_CODE, SAX_ERROR_TEXT, e); |
176 |
|
} |
177 |
|
|
178 |
|
|
179 |
|
|
180 |
|
|
181 |
|
@param |
182 |
|
@return |
183 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
184 |
1
|
public static final XmlSyntaxException createByRuntimeException(... |
185 |
|
final RuntimeException e) { |
186 |
1
|
return new XmlSyntaxException(PROGRAMMING_ERROR_CODE, PROGRAMMING_ERROR_TEXT, e); |
187 |
|
} |
188 |
|
|
189 |
|
} |