|
RE: Bug: Input Stream not closed in unparsed-text(): msg#00151text.xml.saxon.help
Thanks, I'll fix this. (Shouldn't one technically close the Reader rather than the underlying InputStream? I don't suppose it makes any difference in practice.) Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: saxon-help-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx > [mailto:saxon-help-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx] > On Behalf Of > Christian Roth > Sent: 21 June 2005 21:33 > To: Saxon-Help Mailing List > Subject: [saxon] Bug: Input Stream not closed in unparsed-text() > > 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 > _______________________________________________ > saxon-help mailing list > saxon-help-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx > https://lists.sourceforge.net/lists/listinfo/saxon-help > ------------------------------------------------------- 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: | Bug: Input Stream not closed in unparsed-text(): 00151, Christian Roth |
|---|---|
| Next by Date: | does xsl:discard-document work with xsl:result-document?: 00151, alan . painter-Jdski0UBDJ4AvxtiuMwx3w |
| Previous by Thread: | Bug: Input Stream not closed in unparsed-text()i: 00151, Christian Roth |
| Next by Thread: | Re: Bug: Input Stream not closed in unparsed-text(): 00151, Pier Fumagalli |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |