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]