Hello,

In a project I'm working on I hit the same StringIndexOutOfBoundsException.
I'm guessing the Xslthl parser really expects to see constructs that correspond 
to the language to highlight.

What was breaking in my document was:

<programlisting language="java">ldapport=1389</programlisting>

That's okay in a Java .properties file, so I thought it should be Java. But the 
Xslthl parser only processed it after I added a semicolon:

<programlisting language="java">ldapport=1389;</programlisting>

After I set language="ini" the first example worked.

It would be cool to see a line number or the string being processed when the 
exception gets thrown. Took a lot of time to find that missing semicolon.

Regards,
Mark

On Nov 28, 2011, at 3:18 AM, Lars Vogel wrote:

> If I set the language to something unkown, e.g. "shell" then I do not get 
> this error. I assume in this case the syntax highlighter is not called.
> 
> 2011/11/28 Lars Vogel <[email protected]>
> Hello,
> 
> I'm using the syntax highlighting as described here: 
> http://www.sagehill.net/docbookxsl/SyntaxHighlighting.html
> 
> The default is set to Java. If I have the following construct I get an 
> StringIndexOutOfBoundsException. Full stack trace below.
> 
> <para>
>                       <programlisting>
>                               &#xD;
> telnet localhost 5554</programlisting>
>               </para>
> 
> Is this a bug?
> 
> Best regards, Lars
> 
> [xslt] java.lang.StringIndexOutOfBoundsException: String index out of range: 
> -1
>      [xslt]   at java.lang.String.substring(Unknown Source)
>      [xslt]   at net.sf.xslthl.CharIter.startsWith(CharIter.java:236)
>      [xslt]   at net.sf.xslthl.CharIter.startsWith(CharIter.java:210)
>      [xslt]   at 
> net.sf.xslthl.highlighters.NumberHighlighter.highlight(NumberHighlighter.java:185)
>      [xslt]   at 
> net.sf.xslthl.MainHighlighter.highlight(MainHighlighter.java:83)
>      [xslt]   at 
> net.sf.xslthl.ConnectorSaxon6.highlight(ConnectorSaxon6.java:111)
>      [xslt]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>      [xslt]   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>      [xslt]   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown 
> Source)
>      [xslt]   at java.lang.reflect.Method.invoke(Unknown Source)
>      [xslt]   at com.icl.saxon.expr.FunctionProxy.call(FunctionProxy.java:586)
>      [xslt]   at 
> com.icl.saxon.expr.FunctionProxy.enumerate(FunctionProxy.java:466)
>      [xslt]   at 
> com.icl.saxon.expr.NodeListExpression.enumerate(NodeListExpression.java:79)
>      [xslt]   at com.icl.saxon.Controller.applyTemplates(Controller.java:248)
>      [xslt]   at 
> com.icl.saxon.style.XSLApplyTemplates.process(XSLApplyTemplates.java:139)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at com.icl.saxon.style.XSLWhen.process(XSLWhen.java:72)
>      [xslt]   at com.icl.saxon.style.XSLChoose.process(XSLChoose.java:96)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at com.icl.saxon.style.XSLWhen.process(XSLWhen.java:72)
>      [xslt]   at com.icl.saxon.style.XSLChoose.process(XSLChoose.java:96)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at com.icl.saxon.style.XSLWhen.process(XSLWhen.java:72)
>      [xslt]   at com.icl.saxon.style.XSLChoose.process(XSLChoose.java:96)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:229)
>      [xslt]   at 
> com.icl.saxon.style.XSLCallTemplate.process(XSLCallTemplate.java:203)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at com.icl.saxon.style.XSLWhen.process(XSLWhen.java:72)
>      [xslt]   at com.icl.saxon.style.XSLChoose.process(XSLChoose.java:96)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at com.icl.saxon.style.XSLElement.process(XSLElement.java:142)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at 
> com.icl.saxon.style.XSLOtherwise.process(XSLOtherwise.java:48)
>      [xslt]   at com.icl.saxon.style.XSLChoose.process(XSLChoose.java:96)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:229)
>      [xslt]   at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:202)
>      [xslt]   at com.icl.saxon.Controller.applyTemplates(Controller.java:288)
>      [xslt]   at 
> com.icl.saxon.style.XSLApplyTemplates.process(XSLApplyTemplates.java:139)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at 
> com.icl.saxon.style.XSLGeneralVariable.getSelectValue(XSLGeneralVariable.java:238)
>      [xslt]   at 
> com.icl.saxon.style.XSLWithParam.getParamValue(XSLWithParam.java:48)
>      [xslt]   at 
> com.icl.saxon.style.XSLCallTemplate.process(XSLCallTemplate.java:180)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:229)
>      [xslt]   at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:202)
>      [xslt]   at com.icl.saxon.Controller.applyTemplates(Controller.java:297)
>      [xslt]   at 
> com.icl.saxon.style.XSLApplyTemplates.process(XSLApplyTemplates.java:139)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at 
> com.icl.saxon.style.LiteralResultElement.process(LiteralResultElement.java:290)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:229)
>      [xslt]   at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:202)
>      [xslt]   at com.icl.saxon.Controller.applyTemplates(Controller.java:288)
>      [xslt]   at 
> com.icl.saxon.style.XSLApplyTemplates.process(XSLApplyTemplates.java:139)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at 
> com.icl.saxon.style.LiteralResultElement.process(LiteralResultElement.java:290)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:229)
>      [xslt]   at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:202)
>      [xslt]   at com.icl.saxon.Controller.applyTemplates(Controller.java:288)
>      [xslt]   at 
> com.icl.saxon.style.XSLApplyTemplates.process(XSLApplyTemplates.java:139)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at 
> com.icl.saxon.style.LiteralResultElement.process(LiteralResultElement.java:290)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:229)
>      [xslt]   at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:202)
>      [xslt]   at com.icl.saxon.Controller.applyTemplates(Controller.java:288)
>      [xslt]   at 
> com.icl.saxon.style.XSLApplyTemplates.process(XSLApplyTemplates.java:139)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at 
> com.icl.saxon.style.LiteralResultElement.process(LiteralResultElement.java:290)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at 
> com.icl.saxon.style.LiteralResultElement.process(LiteralResultElement.java:290)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:229)
>      [xslt]   at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:202)
>      [xslt]   at com.icl.saxon.Controller.applyTemplates(Controller.java:288)
>      [xslt]   at com.icl.saxon.Controller.defaultAction(Controller.java:313)
>      [xslt]   at com.icl.saxon.Controller.applyTemplates(Controller.java:278)
>      [xslt]   at 
> com.icl.saxon.style.XSLApplyTemplates.process(XSLApplyTemplates.java:139)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at com.icl.saxon.style.XSLIf.process(XSLIf.java:78)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at 
> com.icl.saxon.style.XSLOtherwise.process(XSLOtherwise.java:48)
>      [xslt]   at com.icl.saxon.style.XSLChoose.process(XSLChoose.java:96)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at 
> com.icl.saxon.style.XSLOtherwise.process(XSLOtherwise.java:48)
>      [xslt]   at com.icl.saxon.style.XSLChoose.process(XSLChoose.java:96)
>      [xslt]   at 
> com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:643)
>      [xslt]   at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:229)
>      [xslt]   at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:202)
>      [xslt]   at com.icl.saxon.Controller.applyTemplates(Controller.java:288)
>      [xslt]   at com.icl.saxon.Controller.run(Controller.java:220)
>      [xslt]   at 
> com.icl.saxon.Controller.transformDocument(Controller.java:1125)
>      [xslt]   at com.icl.saxon.Controller.transform(Controller.java:994)
>      [xslt]   at 
> org.apache.tools.ant.taskdefs.optional.TraXLiaison.transform(TraXLiaison.java:194)
>      [xslt]   at 
> org.apache.tools.ant.taskdefs.XSLTProcess.process(XSLTProcess.java:818)
>      [xslt]   at 
> org.apache.tools.ant.taskdefs.XSLTProcess.execute(XSLTProcess.java:406)
>      [xslt]   at 
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
>      [xslt]   at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
>      [xslt]   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown 
> Source)
>      [xslt]   at java.lang.reflect.Method.invoke(Unknown Source)
>      [xslt]   at 
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
>      [xslt]   at org.apache.tools.ant.Task.perform(Task.java:348)
>      [xslt]   at org.apache.tools.ant.Target.execute(Target.java:390)
>      [xslt]   at org.apache.tools.ant.Target.performTasks(Target.java:411)
>      [xslt]   at 
> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
>      [xslt]   at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
>      [xslt]   at 
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
>      [xslt]   at 
> org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
>      [xslt]   at 
> org.apache.tools.ant.Project.executeTargets(Project.java:1251)
>      [xslt]   at 
> org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:424)
>      [xslt]   at 
> org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:138)
>      [xslt] Failed to process null
> 
> 
> -- 
> Lars
> http://www.vogella.de - Eclipse, Android and Java Tutorials
> http://www.twitter.com/vogella - Lars on Twitter
> 
> 
> 
> -- 
> Lars
> http://www.vogella.de - Eclipse, Android and Java Tutorials
> http://www.twitter.com/vogella - Lars on Twitter

Reply via email to