Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML parser throws AssertionErrors when -enableassertions is set #12

Open
veita opened this issue Apr 16, 2020 · 2 comments
Open

HTML parser throws AssertionErrors when -enableassertions is set #12

veita opened this issue Apr 16, 2020 · 2 comments

Comments

@veita
Copy link

veita commented Apr 16, 2020

HTML parser throws AssertionErrors when -enableassertions is set. This makes it difficult to use the validator in test environments where assertions are often enabled.

Caused by: java.lang.AssertionError: strBufLen not reset after previous use!
	at nu.validator.htmlparser.impl.Tokenizer.clearStrBufBeforeUse(Tokenizer.java:852)
	at nu.validator.htmlparser.impl.Tokenizer.stateLoop(Tokenizer.java:1561)
	at nu.validator.htmlparser.impl.Tokenizer.tokenizeBuffer(Tokenizer.java:1341)
	at nu.validator.htmlparser.io.Driver.runStates(Driver.java:320)
	at nu.validator.htmlparser.io.Driver.tokenize(Driver.java:219)
	at nu.validator.htmlparser.sax.HtmlParser.tokenize(HtmlParser.java:488)
	at nu.validator.htmlparser.sax.HtmlParser.parse(HtmlParser.java:408)
	at nu.validator.xml.WiretapXMLReaderWrapper.parse(WiretapXMLReaderWrapper.java:158)
	at nu.validator.validation.SimpleDocumentValidator.checkAsHTML(SimpleDocumentValidator.java:523)
	at nu.validator.validation.SimpleDocumentValidator.checkHtmlInputSource(SimpleDocumentValidator.java:405)
@carlosame
Copy link

I'm persistently getting the strBufLen not reset after previous use errors in my integration testing with versions from 1.4 to 1.4.16 (haven't tested previous), and for example the document currently at https://vk.com/htmlstrap can be used to reproduce it. Could this be fixed?

Here is the 1.4.16 stack trace:

java.lang.AssertionError: strBufLen not reset after previous use!
	at [email protected]/nu.validator.htmlparser.impl.Tokenizer.clearStrBufBeforeUse(Tokenizer.java:940)
	at [email protected]/nu.validator.htmlparser.impl.Tokenizer.stateLoop(Tokenizer.java:3847)
	at [email protected]/nu.validator.htmlparser.impl.Tokenizer.tokenizeBuffer(Tokenizer.java:1429)
	at [email protected]/nu.validator.htmlparser.io.Driver.runStates(Driver.java:320)
	at [email protected]/nu.validator.htmlparser.io.Driver.tokenize(Driver.java:219)
	at [email protected]/nu.validator.htmlparser.dom.HtmlDocumentBuilder.tokenize(HtmlDocumentBuilder.java:263)
	at [email protected]/nu.validator.htmlparser.dom.HtmlDocumentBuilder.parse(HtmlDocumentBuilder.java:312)

Should I file it as a separate bug?

@carlosame
Copy link

When I download the previously mentioned URL with Firefox, it is giving me a different document so I upload the one that I use in my tests:
vk_com.html.gz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants