Rob - I ran the code provided by you and it ran without any problem whatsoever the file was able to be deleted without a problem.
I am running on win2k - i know that no mention of the environment you are running it within has been stated yet. Is it possible that some other process or application that you are using to create the original file (that has nothing to do with java possible) has a hook into the file? ----- Original Message ----- From: "Rob Outar" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, August 15, 2003 10:02 AM Subject: RE: Re[2]: XMLReader not releasing file reference > Did you try it with the code I sent? > > Thanks, > > Rob > > > -----Original Message----- > From: River [mailto:[EMAIL PROTECTED] > Sent: Friday, August 15, 2003 6:14 AM > To: [EMAIL PROTECTED] > Subject: RE: Re[2]: XMLReader not releasing file reference > > > Rob, > I created the simple example, following your directions, and found that > on my system I can always delete file. Maby behaviour on your machinge > is depenedent on your code, that is keeping repherence to open file ???? > > > Mit freundlichen Grüßen, > Best Regards, > River > > -----Original Message----- > From: Sander Bos [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 13, 2003 3:49 PM > To: [EMAIL PROTECTED] > Subject: RE: Re[2]: XMLReader not releasing file reference > > > Dear Rob, > > > try { > > > > String uri = "file:" + in.getAbsolutePath(); > > SAXParserFactory spf = SAXParserFactory.newInstance(); > > SAXParser sp = spf.newSAXParser(); > > XMLReader reader = sp.getXMLReader(); > > reader.setContentHandler(new TestContentHandler()); > > reader.parse(uri); > > > > } > > > > catch (Exception e) { > > System.out.println(in.delete()); > > //assertTrue (e.toString(), false); > > } > > Have you tried not letting Xerces opening the file, but doing it > yourself? (although I looked briefly at the Xerces code Peter McCracken > pointed to and it seems Xerces will always close the files, but there is > relatively a lot going on there). > > So > FileInputStream fis = null; > try { > ... > fis = new FileInputStream(in); > org.xml.sax.InputSource source = new InputSource(fis); > source.setSystemId(uri); > reader.parse(source); > } catch (Exception e) { > if (fis != null) { > fis.close(); > } > assertTrue(in.delete()); > } > > or something along those lines (untested). Then you get to close the > file-stream 'yourself'. > > Kind regards, > > --Sander. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]