You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@excalibur.apache.org by cz...@apache.org on 2007/01/04 09:14:23 UTC

svn commit: r492440 - /excalibur/trunk/components/sourceresolve/src/java/org/apache/excalibur/source/impl/ResourceSource.java

Author: cziegeler
Date: Thu Jan  4 00:14:22 2007
New Revision: 492440

URL: http://svn.apache.org/viewvc?view=rev&rev=492440
Log:
Possible fix for EXLBR-32, always directly close the connection

Modified:
    excalibur/trunk/components/sourceresolve/src/java/org/apache/excalibur/source/impl/ResourceSource.java

Modified: excalibur/trunk/components/sourceresolve/src/java/org/apache/excalibur/source/impl/ResourceSource.java
URL: http://svn.apache.org/viewvc/excalibur/trunk/components/sourceresolve/src/java/org/apache/excalibur/source/impl/ResourceSource.java?view=diff&rev=492440&r1=492439&r2=492440
==============================================================================
--- excalibur/trunk/components/sourceresolve/src/java/org/apache/excalibur/source/impl/ResourceSource.java (original)
+++ excalibur/trunk/components/sourceresolve/src/java/org/apache/excalibur/source/impl/ResourceSource.java Thu Jan  4 00:14:22 2007
@@ -73,20 +73,38 @@
             return;
         }
         
-        URLConnection connection;
+        URLConnection connection = null;
         try
         {
-            connection = m_location.openConnection();
+            try
+            {
+                connection = m_location.openConnection();
+            }
+            catch(IOException ioe)
+            {
+                // Exists but unable to open it??
+                return;
+            }
+    
+            setLastModified(connection.getLastModified());
+            setContentLength(connection.getContentLength());
+            m_mimeType = connection.getContentType();
         }
-        catch(IOException ioe)
+        finally
         {
-            // Exists but unable to open it??
-            return;
+            // we close the connection, see EXLBR-32
+            if ( connection != null )
+            {
+                try
+                {
+                    connection.getInputStream().close();
+                }
+                catch (IOException e)
+                {
+                    // ignore
+                }
+            }
         }
-
-        setLastModified(connection.getLastModified());
-        setContentLength(connection.getContentLength());
-        m_mimeType = connection.getContentType();
     }
     
     public String getMimeType()



---------------------------------------------------------------------
To unsubscribe, e-mail: scm-unsubscribe@excalibur.apache.org
For additional commands, e-mail: scm-help@excalibur.apache.org