[ http://issues.apache.org/jira/browse/XALANJ-1347?page=all ]

Brian Minchau updated XALANJ-1347:
----------------------------------

    Version: Latest Development Code
                 (was: 2.4)

> No locator provided upon stylesheet errors
> ------------------------------------------
>
>          Key: XALANJ-1347
>          URL: http://issues.apache.org/jira/browse/XALANJ-1347
>      Project: XalanJ2
>         Type: Bug
>   Components: transformation, Xalan-interpretive
>     Versions: Latest Development Code
>  Environment: Operating System: Other
> Platform: Other
>     Reporter: Laurent CAPRANI
>     Assignee: Xalan Developers Mailing List

>
> 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

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to