You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/08/26 19:20:57 UTC
DO NOT REPLY [Bug 12048] New: -
output file locked after generation with command line interface
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12048>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12048
output file locked after generation with command line interface
Summary: output file locked after generation with command line
interface
Product: XalanJ2
Version: 2.4Dx
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Xalan
AssignedTo: xalan-dev@xml.apache.org
ReportedBy: cmarton@calendra.com
When using the command line to transform an XML document:
org.apache.xalan.xslt.Process.main(String[])
the generated file is locked until the VM is closed.
This is because the outputStream is never closed in the main().
This is a problem for example when the transformation is included in
an ANT build. Next ANT task can't remove the generated files which may
be mandatory for cleaning.
The following code (works/tested for my needs)inserted near the end of the main
fixes the issue (inserted Line 930):
// closes output stream
if (null != outFileName && strResult!=null) {
java.io.OutputStream out=strResult.getOutputStream();
java.io.Writer writer=strResult.getWriter();
try{
if (out!=null) out.close();
if (writer!=null) writer.close();
}catch(java.io.IOException ie) {
// XXX an error message
}
}