GeezerVison is showing github.com — fix: report fatal XML parsing errors only once as RSC-016 · w3c/epubcheck@62d67e7
File tree
Expand file treeCollapse file tree
Open diff view settings
main/java/com/adobe/epubcheck/xml java/com/adobe/epubcheck/ocf
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/main/java/com/adobe/epubcheck/xml/XMLParser.java +4-1Lines changed: 4 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -162,7 +162,10 @@ public void process() |
162 | 162 | report.message(MessageId.PKG_008, EPUBLocation.of(context), context.path); |
163 | 163 | } catch (SAXException e) |
164 | 164 | { |
165 | | - report.message(MessageId.RSC_005, EPUBLocation.of(context), e.getMessage()); |
| 165 | + // All errors should have already been reported by the error handler |
| 166 | + if (report.getFatalErrorCount() == 0) { |
| 167 | + report.message(MessageId.RSC_016, EPUBLocation.of(context), e.getMessage()); |
| 168 | + } |
166 | 169 | } |
167 | 170 | } |
168 | 171 |
|
|
Collapse file
Copy file name to clipboardExpand all lines: src/test/java/com/adobe/epubcheck/ocf/OPFPeekerTest.java +4-2Lines changed: 4 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -151,14 +151,16 @@ public void testRetrieveVersionNoVersionAttribute() |
151 | 151 | @Test |
152 | 152 | public void testRetrieveVersionNoEqualSign() |
153 | 153 | { |
154 | | - Collections.addAll(expectedErrors, MessageId.RSC_005, MessageId.RSC_005); |
| 154 | + Collections.addAll(expectedErrors, MessageId.RSC_005); |
| 155 | + Collections.addAll(expectedFatals, MessageId.RSC_016); |
155 | 156 | retrieveData("noEqual.opf"); |
156 | 157 | } |
157 | 158 |
|
158 | 159 | @Test |
159 | 160 | public void testRetrieveVersionValueWithoutQuotes() |
160 | 161 | { |
161 | | - Collections.addAll(expectedErrors, MessageId.RSC_005, MessageId.RSC_005); |
| 162 | + Collections.addAll(expectedErrors, MessageId.RSC_005); |
| 163 | + Collections.addAll(expectedFatals, MessageId.RSC_016); |
162 | 164 | retrieveData("valueWithoutQuotes.opf"); |
163 | 165 | } |
164 | 166 |
|
|
Collapse file
Copy file name to clipboardExpand all lines: src/test/resources/epub3/03-resources/resources.feature -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
392 | 392 | Scenario: a not well-formed Package Document is reported |
393 | 393 | When checking file 'conformance-xml-malformed-error.opf' |
394 | 394 | Then fatal error RSC-016 is reported (parsing error) |
395 | | - And error RSC-005 is reported (schema error) |
396 | 395 | And no other errors or warnings are reported |
397 | 396 |
|
398 | 397 | @spec @xref:sec-xml-constraint |
399 | 398 | Scenario: using a not-declared namespace is not allowed |
400 | 399 | When checking file 'conformance-xml-undeclared-namespace-error.opf' |
401 | 400 | Then fatal error RSC-016 is reported (parsing error) |
402 | | - And error RSC-005 is reported (schema error) |
403 | 401 | And no other errors or warnings are reported |
404 | 402 |
|
405 | 403 | Scenario: Verify an attribute value with leading/trailing whitespace is allowed (issue 332) |
|
Collapse file
Copy file name to clipboardExpand all lines: src/test/resources/epub3/06-content-document/content-document-xhtml.feature -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -91,14 +91,12 @@ Feature: EPUB 3 — Content Documents — XHTML |
91 | 91 | Scenario: Report entity references not ending with a semicolon |
92 | 92 | When checking document 'entities-no-semicolon-error.xhtml' |
93 | 93 | Then fatal error RSC-016 is reported |
94 | | - And error RSC-005 is reported |
95 | 94 | And the message contains 'must end with the \';\' delimiter' |
96 | 95 | And no other errors or warnings are reported |
97 | 96 |
|
98 | 97 | Scenario: Report unknown entity references |
99 | 98 | When checking document 'entities-unknown-error.xhtml' |
100 | 99 | Then fatal error RSC-016 is reported |
101 | | - And error RSC-005 is reported |
102 | 100 | And the message contains 'was referenced, but not declared' |
103 | 101 | And no other errors or warnings are reported |
104 | 102 |
|
|