You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Christophe Marton (JIRA)" <xa...@xml.apache.org> on 2006/01/05 10:47:01 UTC
[jira] Created: (XALANJ-2254) NullpointerException when handling a TransformerException
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: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org