Project

Profile

Help

Bug #2244

closed

No location information available when xsl:import fails

Added by Michael Kay almost 10 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Diagnostics
Sprint/Milestone:
Start date:
2014-11-28
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.6
Fix Committed on Branch:
9.6
Fixed in Maintenance Release:
Platforms:

Description

When an xsl:import or xsl:include fails (for example because the referenced file does not exist), the exception that is thrown (or notified to the ErrorListener) contains no location information.

JUnit test case s9apitest/testXsltCompiler/testErrorNotificationFromImportError created to demonstrate the problem

Actions #1

Updated by Michael Kay almost 10 years ago

It's clear why this is happening, less clear how to fix it.

In 9.6, in order to make static variables and shadow attributes work properly, xsl:import and xsl:include directives are now processed (expanded) during the SAX building of the containing module, rather than on completion of this process as before. The routine that is called, loadStylesheetModule, is the same as is used for the top-level module. If the XML parser throws an error processing the included module, loadStylesheet module catches the exception and calls the error listener. But loadStylesheetModule does not know the current location in the module from which it was invoked, so this exception has no location information. If instead of being immediately reported, the exception were thrown back to the caller (the UseWhenFilter), the caller would have a chance to add location information before reporting the error. Making this change, however, could conflict with other users of loadStylesheetModule().

Actions #2

Updated by Michael Kay almost 10 years ago

The following changes fix the problem and seem safe enough:

(a) In StylesheetModule.loadStylesheetModule(), when an exception is caught, only report it (via Compilation.reportError()) if topLevelModule is true.

(b) In UseWhenFilter, if an exception is caught on return from StylesheetModule.loadStylesheetModule, then as well as adding the location information as now, report the error via Compilation.reportError().

Fix applied on the 9.6 and 9.7 branches.

Actions #3

Updated by Michael Kay almost 10 years ago

  • Status changed from In Progress to Resolved
Actions #4

Updated by O'Neil Delpratt almost 10 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in version set to 9.6.0.3

Bug fix patch applied to the Saxon 9.6.0.3 maintenance release

Actions #5

Updated by O'Neil Delpratt almost 9 years ago

  • Sprint/Milestone set to 9.6.0.3
  • Applies to branch 9.6 added
  • Fix Committed on Branch 9.6 added
  • Fixed in Maintenance Release 9.6.0.3 added

Please register to edit this issue

Also available in: Atom PDF