[Biojava-dev] [Bug 2177] Unclosed streams in org.biojava.bio.program.scf.SCF
bugzilla-daemon at portal.open-bio.org
bugzilla-daemon at portal.open-bio.org
Fri Jan 5 10:42:45 UTC 2007
http://bugzilla.open-bio.org/show_bug.cgi?id=2177
------- Comment #1 from andyyatz at gmail.com 2007-01-05 05:42 -------
(In reply to comment #0)
> Hi,
>
> There are problems in the following methods where the input streams have not
> been closed. This can cause a 'too many open files' os error when working
> rapidly over large data sets.
>
> org.biojava.bio.program.scf.SCF.load(File f)
> - FileInputStream fin;
>
> org.biojava.bio.program.scf.SCF.ParserFactory.parse(InputStream in, SCF out,
> long initOffset)
> - DataInputStream din
>
After a quick look at the source:
1). Yes SCF.load(File f) needs to be changed to:
protected void load(File f) throws IOException,
UnsupportedChromatogramFormatException {
FileInputStream fin = new FileInputStream(f);
try {
load(fin, 0);
}
finally {
fin.close();
}
}
Since this method opens the InputStream to the SCF file it has to be
responsible for closing the stream.
2). I don't think that parse(InputStream in, SCF out, long initOffset) should
be closing streams since it does not create them. It should be creating
method's responsibility to close these streams.
--
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the biojava-dev
mailing list