tagsoup leaving file open on windows

56 views
Skip to first unread message

Fred Toth

unread,
Aug 16, 2012, 10:26:14 PM8/16/12
to tagsoup...@googlegroups.com
Hi,

I'm using tagsoup in my application that basically does 1) parse HTML with tag soup, 2) move files to new folder.

The app runs on linux, but I do development on windows and I've just noticed this: It appears that tagsoup is leaving the file open after the call to "parser.parse(systemid)" returns. My move fails on windows (not on linux). If I turn off the parsing, the file moves just fine.

Anybody seen this? Is there a way to make tagsoup close all resources?

Thanks,

Fred

David McMeans

unread,
Nov 28, 2012, 2:54:05 PM11/28/12
to tagsoup...@googlegroups.com


Fred,

Yes, I am seeing this behavior. Quite annoying really. I'll post if I find a solution. So far there doesn't seem to be a way to close the file being read from the "outside".

David

David McMeans

unread,
Nov 28, 2012, 3:21:04 PM11/28/12
to tagsoup...@googlegroups.com
Fred,

I'm using tagSoup 1.2.1.

There appears to be a missing close in the parse() method.

public void parse (InputSource input) throws IOException, SAXException {
setup();
Reader r = getReader(input);
theContentHandler.startDocument();
theScanner.resetDocumentLocator(input.getPublicId(), input.getSystemId());
if (theScanner instanceof Locator) {
theContentHandler.setDocumentLocator((Locator)theScanner);
}
if (!(theSchema.getURI().equals("")))
theContentHandler.startPrefixMapping(theSchema.getPrefix(),
theSchema.getURI());
theScanner.scan(r, this);
r.close();
}

I put the close is as above and everything appears to be working just as before and I can now move / delete the input file without having to first stop my program.

David

On Thursday, August 16, 2012 10:26:14 PM UTC-4, Fred Toth wrote:
Reply all
Reply to author
Forward
0 new messages