incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awi...@apache.org
Subject svn commit: r505048 - in /incubator/adffaces/trunk/trinidad: trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/ trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/ trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/ t...
Date Thu, 08 Feb 2007 21:58:48 GMT
Author: awiner
Date: Thu Feb  8 13:58:47 2007
New Revision: 505048

URL: http://svn.apache.org/viewvc?view=rev&rev=505048
Log:
Call close() on all opened InputStreams

Modified:
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/FacesBeanFactory.java
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/ResourceServlet.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuContentHandlerImpl.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java

Modified: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/FacesBeanFactory.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/FacesBeanFactory.java?view=diff&rev=505048&r1=505047&r2=505048
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/FacesBeanFactory.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/FacesBeanFactory.java
Thu Feb  8 13:58:47 2007
@@ -18,6 +18,7 @@
  */
 package org.apache.myfaces.trinidad.bean;
 
+import java.io.InputStream;
 import java.io.IOException;
 import java.net.URL;
 
@@ -133,11 +134,19 @@
     try
     {
       Properties properties = new Properties();
-      properties.load(url.openStream());
-      if (_LOG.isFine())
-        _LOG.fine("Loading bean factory info from " + url);
-
-      _TYPES_MAP.putAll(properties);
+      InputStream is = url.openStream();
+      try
+      {
+        properties.load(is);
+        if (_LOG.isFine())
+          _LOG.fine("Loading bean factory info from " + url);
+        
+        _TYPES_MAP.putAll(properties);
+      }
+      finally
+      {
+        is.close();
+      }
     }
     catch (IOException ioe)
     {

Modified: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java?view=diff&rev=505048&r1=505047&r2=505048
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java
Thu Feb  8 13:58:47 2007
@@ -18,6 +18,7 @@
  */
 package org.apache.myfaces.trinidad.component;
 
+import java.io.InputStream;
 import java.io.IOException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -1337,10 +1338,18 @@
       if (url != null)
       {
         Properties properties = new Properties();
-        properties.load(url.openStream());
-        String className = (String)
-          properties.get(UIXComponentBase.class.getName());
-        return (FacesBean.Type) cl.loadClass(className).newInstance();
+        InputStream is = url.openStream();
+        try
+        {
+          properties.load(is);
+          String className = (String)
+            properties.get(UIXComponentBase.class.getName());
+          return (FacesBean.Type) cl.loadClass(className).newInstance();
+        }
+        finally
+        {
+          is.close();
+        }
       }
     }
     catch (Exception e)

Modified: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/ResourceServlet.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/ResourceServlet.java?view=diff&rev=505048&r1=505047&r2=505048
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/ResourceServlet.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/ResourceServlet.java
Thu Feb  8 13:58:47 2007
@@ -285,27 +285,34 @@
         {
           Reader r = new InputStreamReader(url.openStream());
           BufferedReader br = new BufferedReader(r);
-          String className = br.readLine().trim();
-          Class<?> clazz = cl.loadClass(className);
           try
           {
-            Constructor<?> decorator = clazz.getConstructor(_DECORATOR_SIGNATURE);
-            ServletContext context = getServletContext();
-            File tempdir = (File)
-                      context.getAttribute("javax.servlet.context.tempdir");
-            ResourceLoader delegate = new DirectoryResourceLoader(tempdir);
-            loader = (ResourceLoader)
-                      decorator.newInstance(new Object[]{delegate});
+            String className = br.readLine().trim();
+            Class<?> clazz = cl.loadClass(className);
+            try
+            {
+              Constructor<?> decorator = clazz.getConstructor(_DECORATOR_SIGNATURE);
+              ServletContext context = getServletContext();
+              File tempdir = (File)
+                context.getAttribute("javax.servlet.context.tempdir");
+              ResourceLoader delegate = new DirectoryResourceLoader(tempdir);
+              loader = (ResourceLoader)
+                decorator.newInstance(new Object[]{delegate});
+            }
+            catch (InvocationTargetException e)
+            {
+              // by default, create new instance with no-args constructor
+              loader = (ResourceLoader) clazz.newInstance();
+            }
+            catch (NoSuchMethodException e)
+            {
+              // by default, create new instance with no-args constructor
+              loader = (ResourceLoader) clazz.newInstance();
+            }
           }
-          catch (InvocationTargetException e)
+          finally
           {
-            // by default, create new instance with no-args constructor
-            loader = (ResourceLoader) clazz.newInstance();
-          }
-          catch (NoSuchMethodException e)
-          {
-            // by default, create new instance with no-args constructor
-            loader = (ResourceLoader) clazz.newInstance();
+            br.close();
           }
         }
         else

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java?view=diff&rev=505048&r1=505047&r2=505048
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java
Thu Feb  8 13:58:47 2007
@@ -19,6 +19,7 @@
 package org.apache.myfaces.trinidadinternal.application;
 
 import java.io.File;
+import java.io.InputStream;
 import java.io.IOException;
 import java.lang.reflect.Constructor;
 import java.net.URL;
@@ -475,7 +476,15 @@
       {
         Properties properties = new Properties();
         _LOG.fine("Loading internal views from {0}",  url);
-        properties.load(url.openStream());
+        InputStream is = url.openStream();
+        try
+        {
+          properties.load(is);
+        }
+        finally
+        {
+          is.close();
+        }
 
         for (Map.Entry<Object, Object> entry : properties.entrySet())
         {

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuContentHandlerImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuContentHandlerImpl.java?view=diff&rev=505048&r1=505047&r2=505048
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuContentHandlerImpl.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuContentHandlerImpl.java
Thu Feb  8 13:58:47 2007
@@ -452,6 +452,8 @@
 
       // Parse the metadata
       parser.parse(inStream, this);
+
+      inStream.close();
     }
     catch (SAXException saxex)
     {

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java?view=diff&rev=505048&r1=505047&r2=505048
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java
Thu Feb  8 13:58:47 2007
@@ -575,6 +575,7 @@
                                            _META_INF_CONFIG_FILE);
               
             allSkinsNodes.add(metaInfSkinsNode);
+            in.close();
           }
         }
         catch (Exception e)



Mime
View raw message