Uploaded image for project: 'Commons Jelly'
  1. Commons Jelly
  2. JELLY-45

resource lookup in compiled scripts does not work properly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0-beta-5
    • core / taglib.core
    • None

    Description

      Take the following code snippet:

      JellyContext context = new JellyContext();
      URL url = ImportTestcase.class.getResource("/resources/import.jelly");
      XMLOutput out = XMLOutput.createXMLOutput(System.out);
      // this works because of the created child context that has knowledge
      // of the URL
      context.runScript(url, out);

      // This does not work because context has no currentURL set
      // This results in a NullPointerException when resolving the
      // stylesheet
      Script script = context.compileScript(url);
      script.run(context, out);
      out.flush()

      A compiled script should manage the lookup of referenced
      resources by its own regardless of the context set. If you
      cache scripts and use different contexts you do not always know
      where the script is from.
      That's why context.setCurrentURL(...) is no solution.

      // import.jelly
      <?xml version="1.0" encoding="ISO-8859-1"?>
      <j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" >
      <x:transform xslt="import.xsl">
      <x:param name="language" value="DE"/>
      <root/>
      </x:transform>
      </j:jelly>

      Attachments

        Activity

          People

            diongillard dion gillard
            vbraun Vincenz Braun
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: