[ https://issues.apache.org/jira/browse/SLING-6445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15805113#comment-15805113 ]
ASF GitHub Bot commented on SLING-6445: --------------------------------------- GitHub user vladbailescu opened a pull request: https://github.com/apache/sling/pull/196 SLING-6445 - HTL scripts do not compile on Windows if the compiler needs to generate any warnings * Improved error/warning line and column computation to take into account any possible line separator * Added test cases and files with different line separators * Added PowerMockito dependency to be able to mock System#lineSeparator static method You can merge this pull request into a Git repository by running: $ git pull https://github.com/vladbailescu/sling issue/SLING-6445 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/sling/pull/196.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #196 ---- ---- > HTL scripts do not compile on Windows if the compiler needs to generate any > warnings > ------------------------------------------------------------------------------------ > > Key: SLING-6445 > URL: https://issues.apache.org/jira/browse/SLING-6445 > Project: Sling > Issue Type: Bug > Components: Scripting > Affects Versions: Scripting Sightly Engine 1.0.18 > Reporter: Vlad Bailescu > Priority: Critical > > If an HTL script with potential warnings is compiled on Windows, the compiler > will fail with a NPE like: > {code} > java.lang.StringIndexOutOfBoundsException: String index out of range: -1 > at java.lang.String.substring(Unknown Source) > at > org.apache.sling.scripting.sightly.compiler.SightlyCompiler.getScriptError(SightlyCompiler.java:170) > at > org.apache.sling.scripting.sightly.compiler.SightlyCompiler.compile(SightlyCompiler.java:149) > at > org.apache.sling.scripting.sightly.impl.engine.SightlyScriptEngine.internalCompile(SightlyScriptEngine.java:135) > at > org.apache.sling.scripting.sightly.impl.engine.SightlyScriptEngine.compile(SightlyScriptEngine.java:80) > at > org.apache.sling.scripting.sightly.impl.engine.extension.use.RenderUnitProvider.provide(RenderUnitProvider.java:126) > at > org.apache.sling.scripting.sightly.impl.engine.extension.use.UseRuntimeExtension.call(UseRuntimeExtension.java:72) > at > org.apache.sling.scripting.sightly.impl.engine.runtime.RenderContextImpl.call(RenderContextImpl.java:75) > {code} > The compiler assumes that system line separators are being used in the files, > which most of the times is not happening as the scripts might have been > edited on another system. -- This message was sent by Atlassian JIRA (v6.3.4#6332)