Bugzilla – Bug 856
LABEL with for attribute to non-existant ID causes internal error
Last modified: 2011-10-24 13:38:46 CEST
Using text field validation option with the following HTML <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title></title> </head> <body> <p><label for="foo">foo</label></p> </body> </html> Triggers 011-08-25 14:17:20.986:INFO::Started SocketConnector@localhost:8011 nu.validator.servlet.VerifierServletTransaction - RuntimeException, doc: null schema: lax: false java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.StringBuffer.charAt(StringBuffer.java:162) at com.thaiopensource.validate.schematron.OutputHandler.startElement(Unknown Source) at net.sf.saxon.event.ContentHandlerProxy.startContent(ContentHandlerProxy.java:362) at net.sf.saxon.event.NamespaceReducer.startContent(NamespaceReducer.java:197) at net.sf.saxon.event.ComplexContentOutputter.startContent(ComplexContentOutputter.java:550) at net.sf.saxon.event.ComplexContentOutputter.characters(ComplexContentOutputter.java:157) at net.sf.saxon.instruct.ValueOf.processLeavingTail(ValueOf.java:245) at net.sf.saxon.instruct.Instruction.process(Instruction.java:93) at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:296) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556) at net.sf.saxon.instruct.Instruction.process(Instruction.java:93) at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:296) at net.sf.saxon.instruct.Choose.processLeavingTail(Choose.java:686) at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:203) at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:345) at net.sf.saxon.instruct.ApplyTemplates$ApplyTemplatesPackage.processLeavingTail(ApplyTemplates.java:527) at net.sf.saxon.instruct.CallTemplate.process(CallTemplate.java:259) at net.sf.saxon.instruct.CallTemplate.processLeavingTail(CallTemplate.java:281) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556) at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:203) at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:345) at net.sf.saxon.instruct.ApplyTemplates$ApplyTemplatesPackage.processLeavingTail(ApplyTemplates.java:527) at net.sf.saxon.instruct.ApplyTemplates.apply(ApplyTemplates.java:212) at net.sf.saxon.instruct.ApplyTemplates.process(ApplyTemplates.java:170) at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:296) at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:203) at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:345) at net.sf.saxon.Controller.transformDocument(Controller.java:1807) at net.sf.saxon.TransformerHandlerImpl.endDocument(TransformerHandlerImpl.java:144) at com.thaiopensource.xml.sax.ForkContentHandler.endDocument(Unknown Source) at com.thaiopensource.xml.sax.ForkContentHandler.endDocument(Unknown Source) at nu.validator.xml.AttributesPermutingXMLReaderWrapper.endDocument(AttributesPermutingXMLReaderWrapper.java:158) at nu.validator.xml.CombineContentHandler.endDocument(CombineContentHandler.java:64) at nu.validator.htmlparser.sax.SAXStreamer.end(SAXStreamer.java:154) at nu.validator.htmlparser.impl.TreeBuilder.endTokenization(TreeBuilder.java:1571) at nu.validator.htmlparser.impl.Tokenizer.end(Tokenizer.java:6518) at nu.validator.htmlparser.io.Driver.tokenize(Driver.java:239) at nu.validator.htmlparser.sax.HtmlParser.tokenize(HtmlParser.java:480) at nu.validator.htmlparser.sax.HtmlParser.parse(HtmlParser.java:423) at nu.validator.xml.WiretapXMLReaderWrapper.parse(WiretapXMLReaderWrapper.java:152) at nu.validator.xml.AttributesPermutingXMLReaderWrapper.parse(AttributesPermutingXMLReaderWrapper.java:285) at nu.validator.servlet.VerifierServletTransaction.validate(VerifierServletTransaction.java:888) at nu.validator.servlet.PageEmitter.emit(PageEmitter.java:28) at nu.validator.servlet.VerifierServletTransaction.service(VerifierServletTransaction.java:694) at nu.validator.servlet.VerifierServlet.doPost(VerifierServlet.java:214) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221) at nu.validator.servlet.MultipartFormDataFilter.doFilter(MultipartFormDataFilter.java:180) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212) at nu.validator.servletfilter.InboundGzipFilter.doFilter(InboundGzipFilter.java:57) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212) at nu.validator.servletfilter.InboundSizeLimitFilter.doFilter(InboundSizeLimitFilter.java:62) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212) at org.mortbay.servlet.UserAgentFilter.doFilter(UserAgentFilter.java:78) at org.mortbay.servlet.GzipFilter.doFilter(GzipFilter.java:131) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
I can't reproduce this in my workspace. But I'll check out another copy and build from scratch and see if I can reproduce it that way.
Created attachment 212 [details] Validator Error Settings Screenshot
Created attachment 213 [details] patch
Thanks for reporting this. It's now fixed in the sources for the validator. http://code.google.com/p/jing-trang/source/detail?r=2359 http://code.google.com/p/jing-trang/source/diff?spec=svn2359&r=2359&format=side&path=/branches/validator-nu/mod/schematron/src/main/com/thaiopensource/validate/schematron/OutputHandler.java