Hey all, I hate to be redundant here :-), but I am hoping the key to getting feedback is persistence. :-) In looking through the source code, I am not seeing where the SAXParser is being closed when an exception is thrown out of the parsing of the XML file. (i.e. the parse(String uri) method in the XMLReader class is interrupted by the throwing of an Exception). This is directly causing a problem in my application because the XMLReader is not letting go of the file when this Exception is thrown, which prevents further file operations (like moving the file). If I am wrong in this observation, if someone would please correct me, I would be greatly appreciative. If I am right, then the file either needs to be closed when the Exception is thrown, OR there needs to be a method available that allows explicit closing of the XML file.
Thanks! BradO -----Original Message----- From: Brad O'Hearne [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 27, 2001 11:04 PM To: [EMAIL PROTECTED]; [email protected] Subject: RE: Explicit file closing Has anyone been able to verify this problem, or have any ideas on the solution? BradO -----Original Message----- From: Brad O'Hearne [mailto:[EMAIL PROTECTED] Sent: Friday, February 23, 2001 7:48 PM To: [EMAIL PROTECTED]; [email protected] Subject: RE: Explicit file closing I was looking through the source on this in the org.apache.xerces.framework.XMLParser class, and it appears that the parse(String systemId) method does not close the InputSource if an Exception is thrown -- it appears parsing has to end gracefully for this to happen. This would also be consistent with the results I am getting below (if an Exception, the file is locked, if it ends gracefully, the file is free). Perhaps I am overlooking something, but the parse method isn't inside a try-catch. If I have read this correctly, I would throw the call to the parse(InputSource is) that resides inside the parse(String systemId) method inside a try-catch block with a finally that closes the InputSource. Let me know if this seems right -- perhaps I missed something. Thanks in advance, BradO -----Original Message----- From: Brad O'Hearne [mailto:[EMAIL PROTECTED] Sent: Friday, February 23, 2001 6:55 PM To: [EMAIL PROTECTED] Subject: Explicit file closing Hello all, I ran into an interesting problem tonight. I am using a SAX2 parser. My app moves my xml file to a new directory immediately following parsing, or if parsing is aborted after a SAXException is thrown. I am getting an access conflict on the file trying to move my file following a SAXException being thrown and parsing being aborted. I have checked the XMLReader interface and noticed that there are no methods declared for explicitly closing the underlying file. Is there some way for the app to explicitly control the closing of the file, and if not, should this be added? (I guess another question is when exactly is the file being closed now?) Thanks in advance for help! BradO --------------------------------------------------------------------- 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]
