Okay, I am thinking of this then:

public void load(String fileName) throws ConfigurationException
    {
                InputStream is=null;
        try {
            is = getPropertyStream(fileName);
                load(is);
        }
        catch (IOException ioe){
                throw new ConfigurationException("Could not load from file " +
fileName,ioe);
        }
        finally{
            if(is !=null){
                try{
                    is.close();
                }
                catch (IOException ioe2){
                    ioe2.printStackTrace();
                }
            }
        }
    }

I don't know, it seems though that if we can't close the stream, should we
keep going?

Eric

> -----Original Message-----
> From: Emmanuel Bourg [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 29, 2004 1:48 PM
> To: Jakarta Commons Developers List
> Subject: Re: [configuration] Closing opened input streams
>
>
> Eric Pugh wrote:
>
> > We can do that..  Just need to trap and throw the resulting
> IOException as a
> > ConfigurationException then...
>
> I wouldn't throw an exception if close() fails, it doesn't prevent using
> the configuration since we have finished reading the stream at this
> point. A warning or a stack trace would be enough.
>
> Emmanuel Bourg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to