[jdom-interest] File lock after validation error

Jason Hunter jhunter at collab.net
Fri Sep 14 13:35:39 PDT 2001

Terje Kvambe wrote:
> But when the validation fails the file is NOT deleted...
> Does anybody know why?

Probably because the file is still open and under Windows you can't
delete a file while it's open (you could under Unix).  If you close it
first, then you can probably delete it.

Alex Rosen wrote:
> Interesting point. Aside from fixing this particular problem, we 
> should add an item to the TODO list to figure out and document 
> who is responsible for closing any streams/readers/writers that 
> are passed to any JDOM method. (i.e. does the method close them, 
> or must the caller be sure to close them?) This is not documented 
> by Xerces/SAX/JAXP, so this may involve determining their behavior 
> and asking them to add similar documentation.
> Alex


Gary Bentley wrote:
> I have encountered problems with stream closing when using JDOM, 
> I generally put in a finally clause just in case but in theory I 
> would have thought that it's JDOMs responsibility since it is the 
> one that opens the stream (or at least from the application level 
> it looks that way).  


He who opens should close, in my opinion.

Does someone want to scan the code ensuring we follow this rule?


More information about the jdom-interest mailing list