From ab915c9633b1300e88bb54558dd29c7d951d9afb Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 7 Jan 2003 07:55:58 +0000 Subject: [PATCH] Close our input stream when we're done with it. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2099 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../bundle/BundledComponentRepository.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/java/com/threerings/cast/bundle/BundledComponentRepository.java b/src/java/com/threerings/cast/bundle/BundledComponentRepository.java index cb1d53e21..85947e5c8 100644 --- a/src/java/com/threerings/cast/bundle/BundledComponentRepository.java +++ b/src/java/com/threerings/cast/bundle/BundledComponentRepository.java @@ -1,5 +1,5 @@ // -// $Id: BundledComponentRepository.java,v 1.20 2002/12/07 02:04:31 shaper Exp $ +// $Id: BundledComponentRepository.java,v 1.21 2003/01/07 07:55:58 mdb Exp $ package com.threerings.cast.bundle; @@ -258,13 +258,21 @@ public class BundledComponentRepository throws IOException { // obtain the image data from our resource bundle - InputStream imgin = _bundle.getResource(path); - if (imgin == null) { - String errmsg = "No such image in resource bundle " + - "[bundle=" + _bundle + ", path=" + path + "]."; - throw new FileNotFoundException(errmsg); + InputStream imgin = null; + try { + imgin = _bundle.getResource(path); + if (imgin == null) { + String errmsg = "No such image in resource bundle " + + "[bundle=" + _bundle + ", path=" + path + "]."; + throw new FileNotFoundException(errmsg); + } + return _imgr.loadImage(imgin); + + } finally { + if (imgin != null) { + imgin.close(); + } } - return _imgr.loadImage(imgin); } // documentation inherited