Issue Details (XML | Word | Printable)

Key: XALANJ-2297
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Brian Minchau
Reporter: Brian Minchau
Votes: 0
Watchers: 1
Operations

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

URIResolver passed wrong base URI for nested include/import

Created: 13/May/06 05:04 AM   Updated: 12/Dec/07 03:33 AM
Return to search
Component/s: parse-or-compile
Affects Version/s: 2.7
Fix Version/s: 2.7.1

Time Tracking:
Not Specified

File Attachments:
  Size
Zip Archive Licensed for inclusion in ASF works 2297.zip 2006-05-13 06:18 AM Brian Minchau 3 kB
Text File Licensed for inclusion in ASF works include-import-patch3.txt 2006-07-13 03:53 AM Brian Minchau 7 kB
Text File Licensed for inclusion in ASF works include-import-patch4.txt 2006-07-13 11:59 PM Brian Minchau 2 kB
Text File Licensed for inclusion in ASF works patch.txt 2006-05-13 05:11 AM Brian Minchau 0.8 kB
Text File Licensed for inclusion in ASF works patch2.txt 2006-07-11 03:45 AM Brian Minchau 11 kB
Issue Links:
Reference
 

Xalan info: PatchAvailable
Reviewer: Christine Li
Resolution Date: 31/Oct/06 03:07 AM


 Description  « Hide
When a user's URI resolver is called the base URI it is given is always the base uri of the primary document. If an included or imported stylesheet itself include another stylesheet then at this point the base is wrong.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Brian Minchau added a comment - 13/May/06 05:11 AM
Attaching patch.txt, the likely patch to ProcessorInclude.java.
This patch simply pushes the base URI of the included or imported stylesheet module onto the stack, and pops it off when done parsing the <xsl:import /> or <xsl:include />. This keeps the stack, especially the top of the stack more up to date.

Testcase to be attached soon.

Brian Minchau added a comment - 13/May/06 06:13 AM
The testcase has three stylesheet modules:
path1/sheet1.xsl
path1/path2/sheet2.xsl
path1/path2/path3/sheet3.xsl

sheet1.xsl has:
    <xsl:import href="path2/sheet2.xsl"/>
sheet2.xsl has:
    <xsl:import href="path3/sheet3.xsl"/>

With your own URI resolver set, to resolve path2/sheet2.xsl
the URI resolver gets called with an href of
path2/sheet2.xsl and base of the primary stylesheet (OK).

Then from within sheet2.xsl the resolver gets called again to resolve path3/sheet3.xsl,
with an href of path2/sheet2.xsl and base of the primary stylesheet (WRONG). The base uri
at this point should be the absolute URI of sheet2.xsl, not the absolute URI of the primary sheet1.xsl

Then the

Brian Minchau added a comment - 13/May/06 06:18 AM
Attaching 2297.zip with the testcase, including test./Test1URIResolver.java

Brian Minchau added a comment - 13/May/06 06:20 AM
In my previous comment I had a typo with path2 vs. path3. I meant to write this:

With your own URI resolver set, to resolve path2/sheet2.xsl
the URI resolver gets called with an href of
path2/sheet2.xsl and base of the primary stylesheet (OK).

Then from within sheet2.xsl the resolver gets called again to resolve path3/sheet3.xsl,
with an href of path3/sheet3.xsl and base of the primary stylesheet (WRONG). The base uri
at this point should be the absolute URI of sheet2.xsl, not the absolute URI of the primary sheet1.xsl

Brian Minchau added a comment - 11/Jul/06 03:45 AM
Attaching patch2, which is the original patch plus changes related to xalanj-2274 that resolve
problems with the base URI inside of external general parsed entities.

The complete fix for xalanj-2274 is bigger than this second patch, but this resolves the issues
related to the base URI and parsed entities.

Brian Minchau added a comment - 12/Jul/06 11:10 PM
Christine Li has agreed to review this patch, although she wants the part of the patch related to xalanj-2274 to be moved out of this issue and into the other one. (Brian M. will make that happen).

Brian Minchau added a comment - 12/Jul/06 11:12 PM
This issue was triaged on July 11, 2006

Brian Minchau added a comment - 13/Jul/06 03:53 AM
Attaching patch3, which is a subset of patch2.

Other parts of patch2 will be moved as a patch under XALANJ-2274.
This is being done under the reviewers request (Christine Li).
I have to agree, 2274 is a different bug.

Brian Minchau added a comment - 13/Jul/06 11:59 PM
Attaching patch4, addressing Christine Li's review.

Thanks to Christine for getting me to clean up the patch by:
> extracting remaining changes associated with XALANJ-2274
> getting me to put all push/pop of base URI inside the process() method
   in neatly bracketed from (rather than push/pop in both the process() and in startElement)

I'm hoping that Christine's approval of patch4 is next.

Note that the attached testcase fails with a file not found exception on sheet3.xsl when the patch is not applied, but has no problems once the patch is applied.

Christine Li added a comment - 14/Jul/06 12:30 AM
The patch looks good. It resolves the reported problem.

Brian Minchau added a comment - 31/Oct/06 03:07 AM
Resolved, I just applied patch4 to the code base.

Brian Minchau added a comment - 11/Dec/07 03:16 PM
This issue is no longer relevant for 2.7.1, it is fixed in 2.7.1.
Changing the affected version to 2.7.

Brian Minchau added a comment - 11/Dec/07 04:57 PM
Would the originator of this issue please verify that this issue is fixed in the 2.7.1 release, by adding a comment to this issue, so that we can close this issue.

A lack of response by February 1, 2008 will be taken as consent that we can close this resolved issue.

Regards,
Brian Minchau

Brian Minchau added a comment - 12/Dec/07 03:33 AM
closing this issue.