ASF Bugzilla – Attachment 31961 Details for
Bug 56908
Resource Leaks found by CID 45133
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Add try-with block to prevent leakage of jar-resource
0001-Add-try-with-block-around-jar-resource-to-prevent-re.patch (text/plain), 1.37 KB, created by
Felix Schumacher
on 2014-09-03 19:46:23 UTC
(
hide
)
Description:
Add try-with block to prevent leakage of jar-resource
Filename:
MIME Type:
Creator:
Felix Schumacher
Created:
2014-09-03 19:46:23 UTC
Size:
1.37 KB
patch
obsolete
>From 6e1f9de9320e6d32bc5633de38cd4f6dba15f230 Mon Sep 17 00:00:00 2001 >From: Felix Schumacher <felix.schumacher@internetallee.de> >Date: Wed, 3 Sep 2014 21:43:54 +0200 >Subject: [PATCH] Add try-with block around jar-resource to prevent resource > leakage identified by coverity scan > >--- > java/org/apache/jasper/compiler/Compiler.java | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > >diff --git a/java/org/apache/jasper/compiler/Compiler.java b/java/org/apache/jasper/compiler/Compiler.java >index b146ce7..4e5d111 100644 >--- a/java/org/apache/jasper/compiler/Compiler.java >+++ b/java/org/apache/jasper/compiler/Compiler.java >@@ -484,8 +484,9 @@ public abstract class Compiler { > // Assume we constructed this correctly > int entryStart = key.lastIndexOf("!/"); > String entry = key.substring(entryStart + 2); >- Jar jar = JarFactory.newInstance(new URL(key.substring(4, entryStart))); >- includeLastModified = jar.getLastModified(entry); >+ try (Jar jar = JarFactory.newInstance(new URL(key.substring(4, entryStart)))) { >+ includeLastModified = jar.getLastModified(entry); >+ } > } else { > if (key.startsWith("jar:") || key.startsWith("file:")) { > includeUrl = new URL(key); >-- >1.9.1 >
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 56908
: 31961