Issue Details (XML | Word | Printable)

Key: JELLY-45
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: dion gillard
Reporter: Vincenz Braun
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons Jelly

resource lookup in compiled scripts does not work properly

Created: 20/Mar/03 09:49 PM   Updated: 16/Sep/04 01:15 AM
Return to search
Component/s: core / taglib.core
Affects Version/s: None
Fix Version/s: 1.0-beta-5

Time Tracking:
Not Specified

Resolution Date: 16/Sep/04 01:15 AM


 Description  « Hide
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>



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
peter royal added a comment - 28/Jul/03 01:49 AM
If you could create a failing testcase for this, that would be superb!

dion gillard added a comment - 13/Sep/04 03:11 AM
Failing test case is in the xml taglib, as TestImport.java

dion gillard added a comment - 15/Sep/04 07:26 AM
This is not just limited to compiled scripts either. I will commit a test for uncompiled scripts that fails too.

dion gillard added a comment - 15/Sep/04 08:35 AM
Vincenz, are you interested in reviewing my solution?

dion gillard added a comment - 16/Sep/04 01:15 AM
Updated TagScript and StaticTagScript to set the context urls when running a script.