Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 943724 Details for
Bug 1149211
InputStreams not properly closed when reading resources
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
patch for resource leaks for properties loading found by coverity
properStreamClosing.patch (text/plain), 7.08 KB, created by
Radim Hatlapatka
on 2014-10-03 14:10:04 UTC
(
hide
)
Description:
patch for resource leaks for properties loading found by coverity
Filename:
MIME Type:
Creator:
Radim Hatlapatka
Created:
2014-10-03 14:10:04 UTC
Size:
7.08 KB
patch
obsolete
>Index: src/main/java/org/apache/catalina/startup/ContextConfig.java >=================================================================== >--- src/main/java/org/apache/catalina/startup/ContextConfig.java (revision 2512) >+++ src/main/java/org/apache/catalina/startup/ContextConfig.java (working copy) >@@ -19,43 +19,17 @@ > package org.apache.catalina.startup; > > >-import java.io.File; >-import java.io.IOException; >-import java.io.InputStream; >-import java.util.ArrayList; >-import java.util.Collection; >-import java.util.HashSet; >-import java.util.Map; >-import java.util.Properties; >-import java.util.Set; >+import org.apache.catalina.*; >+import org.apache.catalina.core.*; >+import org.apache.catalina.deploy.*; >+import org.apache.tomcat.util.http.fileupload.*; >+import org.jboss.web.*; > >-import javax.servlet.HttpMethodConstraintElement; >-import javax.servlet.ServletSecurityElement; >-import javax.servlet.annotation.ServletSecurity.EmptyRoleSemantic; >-import javax.servlet.annotation.ServletSecurity.TransportGuarantee; >+import javax.servlet.*; >+import javax.servlet.annotation.ServletSecurity.*; >+import java.io.*; >+import java.util.*; > >-import org.apache.catalina.Authenticator; >-import org.apache.catalina.Container; >-import org.apache.catalina.Context; >-import org.apache.catalina.Engine; >-import org.apache.catalina.Host; >-import org.apache.catalina.Lifecycle; >-import org.apache.catalina.LifecycleEvent; >-import org.apache.catalina.LifecycleListener; >-import org.apache.catalina.Pipeline; >-import org.apache.catalina.Valve; >-import org.apache.catalina.Wrapper; >-import org.apache.catalina.core.ContainerBase; >-import org.apache.catalina.core.StandardContext; >-import org.apache.catalina.core.StandardEngine; >-import org.apache.catalina.deploy.ErrorPage; >-import org.apache.catalina.deploy.FilterDef; >-import org.apache.catalina.deploy.FilterMap; >-import org.apache.catalina.deploy.LoginConfig; >-import org.apache.catalina.deploy.SecurityCollection; >-import org.apache.catalina.deploy.SecurityConstraint; >-import org.jboss.web.CatalinaLogger; >- > /** > * Startup event listener for a <b>Context</b> that configures the properties > * of that Context, and the associated defined servlets. >@@ -87,8 +61,9 @@ > static { > // Load our mapping properties > authenticators = new Properties(); >+ InputStream is = null; > try { >- InputStream is = ContextConfig.class.getClassLoader().getResourceAsStream("org/apache/catalina/startup/Authenticators.properties"); >+ is = ContextConfig.class.getClassLoader().getResourceAsStream("org/apache/catalina/startup/Authenticators.properties"); > if (is != null) { > authenticators.load(is); > } else { >@@ -96,6 +71,8 @@ > } > } catch (IOException e) { > CatalinaLogger.STARTUP_LOGGER.failedLoadingAuthenticatoMappings(e); >+ } finally { >+ IOUtils.closeQuietly(is); > } > } > >Index: src/main/java/org/apache/jasper/compiler/JDTCompiler.java >=================================================================== >--- src/main/java/org/apache/jasper/compiler/JDTCompiler.java (revision 2512) >+++ src/main/java/org/apache/jasper/compiler/JDTCompiler.java (working copy) >@@ -17,40 +17,21 @@ > > package org.apache.jasper.compiler; > >-import java.io.BufferedOutputStream; >-import java.io.BufferedReader; >+import org.apache.jasper.*; >+import org.apache.tomcat.util.http.fileupload.*; >+import org.eclipse.jdt.core.compiler.*; >+import org.eclipse.jdt.internal.compiler.*; >+import org.eclipse.jdt.internal.compiler.Compiler; >+import org.eclipse.jdt.internal.compiler.classfmt.*; >+import org.eclipse.jdt.internal.compiler.env.*; >+import org.eclipse.jdt.internal.compiler.impl.*; >+import org.eclipse.jdt.internal.compiler.problem.*; >+import org.jboss.web.*; >+ >+import java.io.*; > import java.io.ByteArrayOutputStream; >-import java.io.File; >-import java.io.FileInputStream; >-import java.io.FileNotFoundException; >-import java.io.FileOutputStream; >-import java.io.IOException; >-import java.io.InputStream; >-import java.io.InputStreamReader; >-import java.io.Reader; >-import java.util.ArrayList; >-import java.util.HashMap; >-import java.util.Locale; >-import java.util.Map; >-import java.util.StringTokenizer; >+import java.util.*; > >-import org.apache.jasper.JasperException; >-import org.eclipse.jdt.core.compiler.IProblem; >-import org.eclipse.jdt.internal.compiler.ClassFile; >-import org.eclipse.jdt.internal.compiler.CompilationResult; >-import org.eclipse.jdt.internal.compiler.Compiler; >-import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies; >-import org.eclipse.jdt.internal.compiler.ICompilerRequestor; >-import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy; >-import org.eclipse.jdt.internal.compiler.IProblemFactory; >-import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; >-import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; >-import org.eclipse.jdt.internal.compiler.env.INameEnvironment; >-import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer; >-import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; >-import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; >-import org.jboss.web.JasperLogger; >- > /** > * JDT class compiler. This compiler will load source dependencies from the > * context classloader, reducing dramatically disk access during >@@ -242,8 +223,12 @@ > return false; > } > String resourceName = result.replace('.', '/') + ".class"; >- InputStream is = >- classLoader.getResourceAsStream(resourceName); >+ InputStream is = null; >+ try { >+ is = classLoader.getResourceAsStream(resourceName); >+ } finally { >+ IOUtils.closeQuietly(is); >+ } > return is == null; > } > >Index: src/main/java/org/apache/tomcat/util/http/HttpMessages.java >=================================================================== >--- src/main/java/org/apache/tomcat/util/http/HttpMessages.java (revision 2512) >+++ src/main/java/org/apache/tomcat/util/http/HttpMessages.java (working copy) >@@ -17,10 +17,11 @@ > > package org.apache.tomcat.util.http; > >-import java.io.InputStream; >-import java.util.Properties; >+import org.apache.tomcat.util.http.fileupload.*; >+import org.jboss.web.*; > >-import org.jboss.web.CoyoteLogger; >+import java.io.*; >+import java.util.*; > > /** > * Handle (internationalized) HTTP messages. >@@ -36,11 +37,14 @@ > protected static Properties statusMessages = new Properties(); > > static { >+ InputStream is = null; > try { >- InputStream is = HttpMessages.class.getClassLoader().getResourceAsStream("org/apache/tomcat/util/http/HttpMessages.properties"); >+ is = HttpMessages.class.getClassLoader().getResourceAsStream("org/apache/tomcat/util/http/HttpMessages.properties"); > statusMessages.load(is); > } catch (Exception e) { > CoyoteLogger.HTTP_LOGGER.errorLoadingMessages(e); >+ } finally { >+ IOUtils.closeQuietly(is); > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1149211
:
943724
|
943725