The following issue has been updated:
Updater: Brian Minchau (mailto:[EMAIL PROTECTED])
Date: Fri, 24 Sep 2004 8:29 AM
Changes:
Component changed to transformation
---------------------------------------------------------------------
For a full history of the issue, see:
http://issues.apache.org/jira/browse/XALANJ-1347?page=history
---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/browse/XALANJ-1347
Here is an overview of the issue:
---------------------------------------------------------------------
Key: XALANJ-1347
Summary: No locator provided upon stylesheet errors
Type: Bug
Status: Open
Project: XalanJ2
Components:
Xalan-interpretive transformation
transformation
Versions:
2.4
Assignee: Xalan Developers Mailing List
Reporter: Laurent CAPRANI
Created: Tue, 10 Dec 2002 4:17 PM
Updated: Fri, 24 Sep 2004 8:29 AM
Environment: Operating System: Other
Platform: Other
Description:
Current processing of stylesheet errors does not allow straightforward
processing like this:
=========
StreamSource source = new StreamSource(source_url);
// A stylesheet with an error, for example
// <xsl:apply_templates/><!-- a '_' in place of a '-' -->
StreamSource stylesheet = new StreamSource(stylesheet_url);
StreamResult result = new StreamResult(System.out);
try {
Transformer transformer = factory.newTransformer(stylesheet);
} catch (TransformerConfigurationException tce) {
// Here we get the error message but not the location where the problem
occured:
// javax.xml.transform.TransformerConfigurationException:
// javax.xml.transform.TransformerException:
// javax.xml.transform.TransformerException:
// xsl:apply_templates is not allowed in this position in the
stylesheet!
System.err.println(tce.getMessageAndLocation());
}
=========
The exception that is thrown when parsing an erroneous stylesheet does not
provide a locator.
The original exception (with its locator) is burried deep into a nesting of
exceptions.
The TransformerConfigurationException contains:
- A TransformerConfigurationException (no locator) which contains:
- A TransformerException (no locator) which contains:
- A SaxException which contains:
- A TransformerException (with a locator !)
I suggest that at least the SaxException should be avoided, because the SAX
mechanism should be made transparent. The SaxException that is caught during
parse() (in TransformerFactoryImpl.newTemplates()) would be unpacked and the
encapsulated TransformerException be sent to the fatalError
(TransformerException) Handler.
The default ErrorListener may also make sure to provide a locator for the
exceptions it throws (I've noticed there is an ensureLocationSet(exception) to
do that).
Note: This is probably similar to bug #5872
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]