Expected error is raised only after second (identical) attempt
まだ誰も着手していません。
評価
調査の方向性
まず、HtmlDocumentBuilder、ThrowingErrorHandler、および issue にリンクされている Encoding ISO.html リソースを使って testHtmlIso を再現します。最初の parse(uri) とそのエラーハンドラーの設定を追跡します。壊れたドキュメント、または警告を生成するドキュメントが登録済みのハンドラーを発火させ、最初の同一の parse で例外をスローすれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Java
- スター
- 65
- フォーク
- 29
- 平均マージ
- 11日 21時間
- マージ済み PR(30日)
- 3
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
validator/htmlparser のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
validator/htmlparser#96 · コメント 1 件 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
validator/htmlparser#95 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 55/100
validator/htmlparser#87 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
validator/htmlparser#79 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
validator/htmlparser#60 ·
validator/htmlparser の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
checkstyle/test-configs#263 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
apache/cloudstack#14222 ·
-
[BUG]茶杯方块在取茶时会引发崩溃 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
1.0.0-alpha2 Type/Improvement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
wso2/dpdp-accelerator#272 ·