Author: markt
Date: Mon Sep 1 10:06:12 2014
New Revision: 1621726
URL: http://svn.apache.org/r1621726
Log:
Partial fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=56900
Fix resource leak reading property files
Based on a patch by Felix Schumacher
Modified:
tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1621726&r1=1621725&r2=1621726&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Mon Sep 1
10:06:12 2014
@@ -138,20 +138,16 @@ public class ContextConfig implements Li
static {
// Load our mapping properties for the standard authenticators
- InputStream is =
- ContextConfig.class.getClassLoader().getResourceAsStream(
- "org/apache/catalina/startup/Authenticators.properties");
- Properties props = null;
- props = new Properties();
- if (is != null) {
- try {
+ Properties props = new Properties();
+ try (InputStream is =
ContextConfig.class.getClassLoader().getResourceAsStream(
+ "org/apache/catalina/startup/Authenticators.properties");) {
+ if (is != null) {
props.load(is);
- } catch (IOException e) {
- props = null;
}
+ } catch (IOException ioe) {
+ props = null;
}
authenticators = props;
-
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]