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!

Morgan Delagrange made changes - 04/Sep/03 11:15 PM
Field Original Value New Value
Original Estimate 0
Component/s core / taglib.core [ 10421 ]
Remaining Estimate 0h [ 0 ]
Morgan Delagrange made changes - 09/Sep/03 05:32 PM
Affects Version/s 1.0 [ 10216 ]
Morgan Delagrange made changes - 09/Sep/03 05:36 PM
Affects Version/s 1.0 [ 10216 ]
Fix Version/s 1.0 [ 10216 ]
dion gillard made changes - 13/Sep/04 02:36 AM
Assignee dion gillard [ diongillard ]
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?

Repository Revision Date User Message
ASF #136332 Thu Sep 16 01:12:11 UTC 2004 dion JELLY-45. Resource lookup in compiled scripts does not work correctly
Files Changed
MODIFY /jakarta/commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/impl/StaticTagScript.java
MODIFY /jakarta/commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/impl/TagScript.java
MODIFY /jakarta/commons/proper/jelly/trunk/xdocs/changes.xml

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

dion gillard made changes - 16/Sep/04 01:15 AM
Fix Version/s 1.0 [ 10216 ]
Resolution Fixed [ 1 ]
Status Open [ 1 ] Closed [ 6 ]
Fix Version/s 1.0-beta-5 [ 10783 ]