Expected error is raised only after second (identical) attempt
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start by reproducing testHtmlIso with HtmlDocumentBuilder, the ThrowingErrorHandler, and the Encoding ISO.html resource linked in the issue. Trace the first parse(uri) and its error-handler setup; done means the malformed or warning-producing document triggers the registered handler and throws on the first identical parse.
Written by the indexing model from the issue text.
Description
The following code throws only after second call to parse, instead of throwing upon first call as expected.
private static final class ThrowingErrorHandler implements ErrorHandler {
@Override
public void warning(SAXParseException exception) throws SAXParseException {
LOGGER.info("Warning while processing.", exception);
throw exception;
}
@Override
public void fatalError(SAXParseException exception) throws SAXParseException {
LOGGER.info("Fatal while processing.", exception);
throw exception;
}
@Override
public void error(SAXParseException exception) throws SAXParseException {
LOGGER.info("Error while processing.", exception);
throw exception;
}
}
@Test
public void testHtmlIso() throws Exception {
String uri = "https://github.com/oliviercailloux/JARiS/raw/refs/heads/main/src/test/resources/io/github/oliviercailloux/jaris/xml/Html/Encoding%20ISO.html";
HtmlDocumentBuilder builder = new HtmlDocumentBuilder();
builder.setErrorHandler(new ThrowingErrorHandler());
// logs no warning, does not throw
builder.parse(uri);
builder.setErrorHandler(new ThrowingErrorHandler());
// logs a warning then throws
builder.parse(uri);
}
Explanation
The document is supposed to raise a warning when parsed, and given the registered ThrowingErrorHandler, it is supposed to log then throw an exception when parsing. But the first parse completes without logging or throwing anything. Only the second one does.
- Dominant language
- Java
- Stars
- 65
- Forks
- 29
- Avg merge
- 11d 21h
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from validator/htmlparser
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
validator/htmlparser#96 · 1 comment · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
validator/htmlparser#95 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
validator/htmlparser#87 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
validator/htmlparser#79 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
validator/htmlparser#60 ·
All issues in validator/htmlparser
Similar issues
-
bug untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
opensearch-project/ml-commons#5094 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
emitter:client:csharp feature
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
affects/8.10 affects/8.9 component/clients kind/bug likelihood/mid severity/mid
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Two open-case totals on one screen: the Programs tile says 15,858 and the nav badge says 15,868 Openbug frontend maui-pilot
Difficulty 2/5 1-3 hours Newbie friendliness 72/100