xmlns:redirect="http://xml.apache.org/xalan/redirect" write does not close File
handle
--------------------------------------------------------------------------------------
Key: XALANJ-2517
URL: https://issues.apache.org/jira/browse/XALANJ-2517
Project: XalanJ2
Issue Type: Improvement
Security Level: No security risk; visible to anyone (Ordinary problems in
Xalan projects. Anybody can view the issue.)
Components: Xalan-extensions
Affects Versions: 2.7.1
Environment: Windows Server standard 2008 SP2 32bit
Reporter: JF
Priority: Critical
When using the redirect extension with XSLTC;
System.setProperty("javax.xml.transform.TransformerFactory",
"org.apache.xalan.xsltc.trax.TransformerFactoryImpl");
the following
<redirect:write file="{$lopFile}">
<LopNumber><xsl:value-of
select="$lopNumber"/></LopNumber>
<xsl:fallback><xsl:message
terminate="yes">Outputing of lops requires
http://xml.apache.org/xalan/redirect:write, if you are using another processor
or xslt2.0 there are other choices, not implemented
yet</xsl:message></xsl:fallback>
</redirect:write>
does not close the File handle it creates.
This causes me problems as I cannot delete the file ( I use it to output
temporary data ), and it is running in a server app that then clogs up the temp
dir.
If I call System.gc() after the transform call it is cleaned up. This is a
work around ( short of changing the Xalan code, or using my own handler ).
There does not seem to be any opportunity to override
TransletOutputHandlerFactory.
You can watch the behaviour in ProcessMonitor from sysinternals to confirm this
is what is happening.
Tracing the source I find that;
AbstractTranslet
public void closeOutputHandler(SerializationHandler handler) {
try {
handler.endDocument();
handler.close();
}
catch (Exception e) {
// what can you do?
}
}
calls close on the SerializationHandler. BUT the handler instance is of type
org.apache.xml.serializer.ToXMLStream
which does not override the close method of
org.apache.xml.serializer.SerializerBase ( which after all does have the writer
var ), this in turn does nothing.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]