[Biojava-dev] [Bug 2186] ABIFparser never releases file resouce when generated with a File

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Wed Jan 17 09:45:10 UTC 2007


http://bugzilla.open-bio.org/show_bug.cgi?id=2186





------- Comment #1 from andyyatz at gmail.com  2007-01-17 04:45 -------
(In reply to comment #0)
> Hi all,
> 
> I've detected a resource problem in the use of the following object constructor
> 
> org.biojava.bio.program.abi.ABIFParser(File f)
> 
> If you generate the parser in this manner the generated RandomAccessFile is
> never closed and causes a resource leak.  The way the code is written I cannot
> see an obvious place to close this, but there appears to be a simple fix in
> that you can use the alternative method:
> 
> org.biojava.bio.program.abi.ABIFParser(InputStream in)
> 
> and control the closing outside of Biojava.
> 
> As I say I'm not sure at which point it's safe to close the stream in
> ABIFParser but the File method could be removed??
> 
> Keiran
> 

It would seem that way without a close method introduced into the parser which
then causes more problems. I would prefer a deprecation of the constructor to
warn future users that this is not the preferred way of creating an ABIFParser. 

Maybe an extension to this class should be a static builder method which takes
in a file, creates the required stream, passes out the finished object and
makes sure to clean up after itself. I don't know it this is possible as I've
only every gone into the guts of the ABI parser once.


-- 
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