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

--format does not work in latest release #5

Closed
darthcav opened this issue Aug 28, 2014 · 3 comments
Closed

--format does not work in latest release #5

darthcav opened this issue Aug 28, 2014 · 3 comments
Labels

Comments

@darthcav
Copy link

There seems to be a bug in the latest release with --format flag.

Test file: https://gist.github.com/cavweb20/a24915082675227cc65a#file-gistfile1-html

Running:

java -jar vnu.jar test_01.html

gives correctly:

"file:test_01.html":9.12-9.12: error: The element “header” must not appear as a descendant of the “footer” element.

But:

java -jar vnu.jar --format json test_01.html

gives an exception:

"file:test_01.html":-1:-1: warning: Illegal state for callback.
Exception in thread "main" org.xml.sax.SAXException: Illegal state for callback.
        at nu.validator.json.Serializer.endObject(Serializer.java:227)
        at nu.validator.messages.JsonMessageEmitter.endMessages(JsonMessageEmitter.java:107)
        at nu.validator.messages.MessageEmitterAdapter.end(MessageEmitterAdapter.java:639)
        at nu.validator.client.SimpleCommandLineValidator.end(SimpleCommandLineValidator.java:205)
        at nu.validator.client.SimpleCommandLineValidator.main(SimpleCommandLineValidator.java:175)

Also:

java -jar vnu.jar --format xml test_01.html

gives an exception:

Exception in thread "main" java.util.NoSuchElementException
        at java.util.LinkedList.getFirst(LinkedList.java:242)
        at nu.validator.htmlparser.sax.XmlSerializer.startPrefixMappingPrivate(XmlSerializer.java:728)
        at nu.validator.htmlparser.sax.XmlSerializer.startElement(XmlSerializer.java:554)
        at nu.validator.messages.XmlSaxEmitter.startElement(XmlSaxEmitter.java:49)
        at nu.validator.messages.XmlMessageEmitter.startMessage(XmlMessageEmitter.java:92)
        at nu.validator.messages.MessageEmitterAdapter.startMessage(MessageEmitterAdapter.java:1575)
        at nu.validator.messages.MessageEmitterAdapter.messageWithoutExtract(MessageEmitterAdapter.java:798)
        at nu.validator.messages.MessageEmitterAdapter.message(MessageEmitterAdapter.java:731)
        at nu.validator.messages.MessageEmitterAdapter.messageFromSAXParseException(MessageEmitterAdapter.java:698)
        at nu.validator.messages.MessageEmitterAdapter.error(MessageEmitterAdapter.java:507)
        at nu.validator.messages.MessageEmitterAdapter.error(MessageEmitterAdapter.java:469)
        at org.whattf.checker.Checker.err(Checker.java:106)
        at org.whattf.checker.schematronequiv.Assertions.startElement(Assertions.java:1584)
        at com.thaiopensource.xml.sax.ForkContentHandler.startElement(Unknown Source)
        at com.thaiopensource.xml.sax.ForkContentHandler.startElement(Unknown Source)
        at com.thaiopensource.xml.sax.ForkContentHandler.startElement(Unknown Source)
        at com.thaiopensource.xml.sax.ForkContentHandler.startElement(Unknown Source)
        at com.thaiopensource.xml.sax.ForkContentHandler.startElement(Unknown Source)
        at com.thaiopensource.xml.sax.ForkContentHandler.startElement(Unknown Source)
        at com.thaiopensource.xml.sax.ForkContentHandler.startElement(Unknown Source)
        at com.thaiopensource.xml.sax.ForkContentHandler.startElement(Unknown Source)
        at com.thaiopensource.xml.sax.ForkContentHandler.startElement(Unknown Source)
        at com.thaiopensource.xml.sax.ForkContentHandler.startElement(Unknown Source)
        at nu.validator.htmlparser.sax.SAXStreamer.elementPushed(SAXStreamer.java:146)
        at nu.validator.htmlparser.sax.SAXStreamer.elementPushed(SAXStreamer.java:35)
        at nu.validator.htmlparser.impl.TreeBuilder.push(TreeBuilder.java:4505)
        at nu.validator.htmlparser.impl.TreeBuilder.appendToCurrentNodeAndPushElementMayFoster(TreeBuilder.java:5248)
        at nu.validator.htmlparser.impl.TreeBuilder.startTag(TreeBuilder.java:2058)
        at nu.validator.htmlparser.impl.Tokenizer.emitCurrentTagToken(Tokenizer.java:1138)
        at nu.validator.htmlparser.impl.Tokenizer.stateLoop(Tokenizer.java:1653)
        at nu.validator.htmlparser.impl.Tokenizer.tokenizeBuffer(Tokenizer.java:1351)
        at nu.validator.htmlparser.io.Driver.runStates(Driver.java:302)
        at nu.validator.htmlparser.io.Driver.tokenize(Driver.java:219)
        at nu.validator.htmlparser.sax.HtmlParser.tokenize(HtmlParser.java:480)
        at nu.validator.htmlparser.sax.HtmlParser.parse(HtmlParser.java:423)
        at nu.validator.validation.SimpleDocumentValidator.checkAsHTML(SimpleDocumentValidator.java:320)
        at nu.validator.validation.SimpleDocumentValidator.checkHtmlFile(SimpleDocumentValidator.java:277)
        at nu.validator.client.SimpleCommandLineValidator.checkHtmlFile(SimpleCommandLineValidator.java:266)
        at nu.validator.client.SimpleCommandLineValidator.checkFiles(SimpleCommandLineValidator.java:218)
        at nu.validator.client.SimpleCommandLineValidator.main(SimpleCommandLineValidator.java:174)
@sideshowbarker
Copy link
Contributor

Thanks for taking time to report this. Yeah, it seems that after the previous release I definitely broke something around the output formats. I'll get it figured out and fixed asap. In the mean time, the workaround is to instead use the https://github.com/validator/validator.github.io/releases/tag/20140222 for now.

@sideshowbarker
Copy link
Contributor

I'll ping this issue again when I have a new release ready that includes the fix.

FYI I also added a regression test to the vnu.jar build:
https://github.com/validator/build/commit/e680d8e9cedbf6cdd24fa158011b70b5c90664a1

@sideshowbarker
Copy link
Contributor

OK, I've now pushed a new release to https://github.com/validator/validator.github.io/releases/tag/20140901 that includes this fix

cvrebert added a commit to cvrebert/lmvtfy that referenced this issue Oct 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants