factory beans leave created stream open

Description

X509CertificateFactoryBean opens a FileInputStream on the provided file but never closes it. I don't see anything in the vt-crypt implementation that closes this stream either, and the stream is ultimately passed to a CertificateFactory: again, closing the provided stream does not appear to be part of the interface contract.

This looks like a potential file descriptor leak. It's probably not a big deal in static-calling contexts because the FileInputStream object will eventually be garbage-collected and implicitly closed, but if you have a large Spring configuration with many uses of X509CertificateFactoryBean then I imagine it might mount up.

Environment

None

Activity

Brent Putman October 25, 2016 at 1:05 AM

Closing old issue, now completed.

Ian Young May 30, 2014 at 9:32 AM

Done, rev 572.

Ian Young May 29, 2014 at 2:00 PM

Correct approach to fix this now that we're on Java 7 is try-with-resource.

Ian Young May 29, 2014 at 1:59 PM

Same problems exists in most of the other classes in this package.

Fixed

Details

Assignee

Reporter

Affects versions

Created July 18, 2013 at 9:58 AM
Updated October 25, 2016 at 1:05 AM
Resolved May 30, 2014 at 9:32 AM