[ 
https://issues.apache.org/jira/browse/XALANJ-2252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13919569#comment-13919569
 ] 

Paul Duffin commented on XALANJ-2252:
-------------------------------------

This problem is affecting Android - 
https://code.google.com/p/android/issues/detail?id=66421.

Henry, your explanation was very useful in helping me to understand the issue, 
JAXP definitely is inconsistent in the way it describes how to handle errors.

> TransformerFactoryImpl.newTemplates is broken according to JAXP 1.3 specs
> -------------------------------------------------------------------------
>
>                 Key: XALANJ-2252
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2252
>             Project: XalanJ2
>          Issue Type: Bug
>          Components: transformation
>    Affects Versions: 2.7
>         Environment: JDK 1.3 and/or 1.4 (use Xalan with endorsed mechanism)
>            Reporter: Antonio Arena
>            Priority: Critical
>
> According to the JAXP 1.3 specs: 
> http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/transform/TransformerFactory.html#newTemplates(javax.xml.transform.Source)
> or according to the JAXP 1.2 specs: 
> http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/transform/TransformerFactory.html#newTemplates(javax.xml.transform.Source)
> the newTemplates method *never* returns a null Templates object.
> I created an XSL file that used a variable that wasn't declared. This causes 
> the org.apache.xpath.operations.Variable class to throw a 
> WrappedRuntimeException that looks like this when written to System.err:
> 2005-12-30 11:12:19 StandardContext[/enginframe]: 
> file:/opt/bruno/412b/enginframe/plugins/filemanager/WEBAPP/layout.xsl; Line 
> #22; Column #62; org.apache.xml.utils.WrappedRuntimeException: Could not find 
> variable with the name of img_path
> My code, since I've been using Xalan 2, does the following:
> ...
> Templates templates = fetchTemplates(source);
> if(templates == null) {
>     templates = transformerFactory.newTemplates(source);
>     // store templates object and use it
>     // now I get a NPE !!!
>     ...
> }
> ...
> I couldn't understand why using Xalan 2.6.0 the newTemplates method would 
> throw a TransformerConfigurationException while using Xalan 2.7.0 I get a 
> NPE. So I investigated the code and I found out that the DefaultErrorHandler 
> class changed exception handling policy. In Xalan 2.6.0 it would just rethrow 
> the TransformerException, while in Xalan 2.7.0 it prints it to System.err. 
> Now (Xalan 2.7.0) at line 951 in TransformerFactoryImpl, after logging the 
> fatal error that isn't rethrown, a null Templates object is returned. This 
> breaks the specs. In Xalan 2.6.0 this didn't happen because the fatal error 
> is rethrown (so line 821 in TransformerFactoryImpl of Xalan 2.6.0 is never 
> executed!)
> I assigned critical to this bug because I've had crash and loss of data. No 
> priority level exists for breaking specs ;)



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to