commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolás Meléndez <>
Subject [Common Configuration] Bad Exception Handling in ConfigurationFactory
Date Tue, 14 Sep 2010 14:48:03 GMT
Hi there, i was looking code at ConfigurationFactory and maybe a find
a problem, what do you think?

in class ConfigurationFactory, line 184:

if digester.parse(input); throws an exception,  the input stream
doesn't close, and a process will leak of resources.

i think there should be a finally which closes the stream no matter
what happen to the parsing, maybe something like this:

        catch (SAXException saxe)
            log.error("SAX Exception caught", saxe);
            throw new ConfigurationException("SAX Exception caught", saxe);
 finally {

	try {
	} catch (IOException ioe)
            log.error("IO Exception caught", ioe);
            throw new ConfigurationException("IO Exception caught", ioe);


        return builder.getConfiguration();

What people think here, i am right?

Nicolas Melendez

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message