Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-6445

HTL scripts do not compile on Windows if the compiler needs to generate any warnings

    XMLWordPrintableJSON

Details

    Description

      If an HTL script with potential warnings is compiled on Windows, the compiler will fail with a NPE like:

      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)
      

      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.

      Attachments

        Issue Links

          Activity

            People

              radu Radu Cotescu
              vladb Vlad Bailescu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: