You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2018/05/08 16:01:12 UTC

[myfaces] branch 2.3.x updated: MYFACES-4228 File Descriptor leak in DefaultFaceletFactory

This is an automated email from the ASF dual-hosted git repository.

deki pushed a commit to branch 2.3.x
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/2.3.x by this push:
     new a46b683  MYFACES-4228 File Descriptor leak in DefaultFaceletFactory
a46b683 is described below

commit a46b683b6839a5866ead502e3e349fe45a1afcd1
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Fri May 4 14:28:00 2018 +0100

    MYFACES-4228 File Descriptor leak in DefaultFaceletFactory
---
 .../view/facelets/impl/DefaultFaceletFactory.java       | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java b/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java
index 6d40b3f..2085932 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java
@@ -333,9 +333,10 @@ public final class DefaultFaceletFactory extends FaceletFactory
         {
             // Should check for file modification
 
+            URLConnection conn = null;
             try
             {
-                URLConnection conn = facelet.getSource().openConnection();
+                conn = facelet.getSource().openConnection();
                 long lastModified = ResourceLoaderUtils.getResourceLastModified(conn);
 
                 return lastModified == 0 || lastModified > target;
@@ -344,6 +345,20 @@ public final class DefaultFaceletFactory extends FaceletFactory
             {
                 throw new FaceletException("Error Checking Last Modified for " + facelet.getAlias(), e);
             }
+            finally
+            {
+                if (conn != null)
+                {
+                    try
+                    {
+                        conn.getInputStream().close();
+                    }
+                    catch (Exception e)
+                    {
+                        // Ignored
+                    }
+                }
+            }
         }
 
         return false;

-- 
To stop receiving notification emails like this one, please contact
deki@apache.org.