NullpointerException when handling a TransformerException
---------------------------------------------------------
Key: XALANJ-2254
URL: http://issues.apache.org/jira/browse/XALANJ-2254
Project: XalanJ2
Type: Bug
Components: Xalan
Versions: 2.7
Reporter: Christophe Marton
When a TransfomerException is thrown, a NullpointerException occurs if its
locator is null:
Look at at line 1407 of org.apache.xalan.transformer.TransformerImpl in method
'transformNode':
else if(se instanceof TransformerException)
{
TransformerException te = ((TransformerException)se);
SAXSourceLocator sl = new SAXSourceLocator( te.getLocator() );
m_serializationHandler.fatalError(new
org.xml.sax.SAXParseException(te.getMessage(), sl, te));
}
te.getLocator() may be null, and the SAXSourceLocator constructor fails with
NPE.
It results in the fact that the foolowing line is not call and the regular
SAXParseException is not raised.
Then, the parsing fails silently.
I suggest:
TransformerException te = ((TransformerException)se);
SAXSourceLocator sl = null;
if (te.getLocator() !=null ) {
sl = new SAXSourceLocator( te.getLocator() );
}
m_serializationHandler.fatalError(new
org.xml.sax.SAXParseException(te.getMessage(), sl, te));
(SAXParseException accepts null SAXSourceLocator in its constructor)
--
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]