myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1594547 - /myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheImpl.java
Date Wed, 14 May 2014 11:48:59 GMT
Author: lu4242
Date: Wed May 14 11:48:59 2014
New Revision: 1594547

URL: http://svn.apache.org/r1594547
Log:
MYFACES-3888 Resource from classpath locked on windows after change in eclipse (Thanks to
Patrick McLaren for provide this patch)

Modified:
    myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheImpl.java

Modified: myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheImpl.java?rev=1594547&r1=1594546&r2=1594547&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheImpl.java
(original)
+++ myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheImpl.java
Wed May 14 11:48:59 2014
@@ -19,6 +19,7 @@
 package org.apache.myfaces.view.facelets.impl;
 
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.URL;
 import java.net.URLConnection;
 import java.util.HashMap;
@@ -154,9 +155,10 @@ class FaceletCacheImpl extends FaceletCa
         {
             // 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;
@@ -165,6 +167,25 @@ class FaceletCacheImpl extends FaceletCa
             {
                 throw new FaceletException("Error Checking Last Modified for " + facelet.getAlias(),
e);
             }
+            finally
+            {
+                // finally close input stream when finished, if fails just continue.
+                if (conn != null)
+                {
+                    try 
+                    {
+                        InputStream is = conn.getInputStream();
+                        if (is != null)
+                        {
+                            is.close();
+                        }
+                    }
+                    catch (IOException e)
+                    {
+                        // Ignore 
+                    }
+                }
+            }
         }
 
         return false;



Mime
View raw message