|
Bug: Input Stream not closed in unparsed-text(): msg#00150text.xml.saxon.help
Hello, in net.sf.saxon.functions.UnparsedText, the InputStream for reading from the specified URL is not explicitly closed after retrieving the data. This has the negative side effect that the read-from file can be deleted or modified only after a garbage collector run. I have created some sort of batching capability in Java where Saxon is one task, and the deletion of the source file the immediately following one. On Windows, the delete operation fails with a "file is in use" error. I verified that after having the garbage collector run in some way after Saxon finishes, the lock is relinquished. I modified the source of the readFile() method to read: ... while (true) { actual = reader.read(buffer, 0, 2048); if (actual<0) break; sb.append(buffer, 0, actual); } /* --> */ is.close(); // <- added [rC] return sb.condense(); ... After that, I could delete the file immediately. Could you please check if this is a reasonable fix and does not pose problems for other sorts of InputStream (e.g. from a http connection instead of the local file system)? If it is ok, please consider adding it in an upcoming release. Kind regards Christian Roth ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: Omit-xml-declaration='yes' not working in UTF-16: 00150, Michael Kay |
|---|---|
| Next by Date: | RE: Bug: Input Stream not closed in unparsed-text(): 00150, Michael Kay |
| Previous by Thread: | Omit-xml-declaration="yes" not working in UTF-16i: 00150, Neil Atkinson |
| Next by Thread: | RE: Bug: Input Stream not closed in unparsed-text(): 00150, Michael Kay |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |