myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bom...@apache.org
Subject svn commit: r743108 - /myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
Date Tue, 10 Feb 2009 21:25:48 GMT
Author: bommel
Date: Tue Feb 10 21:25:47 2009
New Revision: 743108

URL: http://svn.apache.org/viewvc?rev=743108&view=rev
Log:
minor code cleanup

Modified:
    myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java

Modified: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java?rev=743108&r1=743107&r2=743108&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
(original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
Tue Feb 10 21:25:47 2009
@@ -444,9 +444,8 @@
     {
         try
         {
-            for (Iterator<String> iterator = FACTORY_NAMES.iterator(); iterator.hasNext();)
+            for (String factoryName : FACTORY_NAMES)
             {
-                String factoryName = iterator.next();
                 Iterator<URL> it = ClassUtils.getResources(META_INF_SERVICES_RESOURCE_PREFIX
+ factoryName, this);
                 while (it.hasNext())
                 {
@@ -463,30 +462,41 @@
                     {
                         throw new FacesException("Unable to read class name from file " +
url.toExternalForm(), e);
                     }
-                    br.close();
-                    isr.close();
-                    stream.close();
+                    finally
+                    {
+                        if (br != null)
+                        {
+                            br.close();
+                        }
+                        if (isr != null)
+                        {
+                            isr.close();
+                        }
+                        if (stream != null)
+                        {
+                            stream.close();
+                        }
+                    }
+
 
                     if (log.isInfoEnabled())
+                    {
                         log.info("Found " + factoryName + " factory implementation: " + className);
+                    }
 
                     if (factoryName.equals(FactoryFinder.APPLICATION_FACTORY))
                     {
                         getDispenser().feedApplicationFactory(className);
-                    }
-                    else if (factoryName.equals(FactoryFinder.FACES_CONTEXT_FACTORY))
+                    } else if (factoryName.equals(FactoryFinder.FACES_CONTEXT_FACTORY))
                     {
                         getDispenser().feedFacesContextFactory(className);
-                    }
-                    else if (factoryName.equals(FactoryFinder.LIFECYCLE_FACTORY))
+                    } else if (factoryName.equals(FactoryFinder.LIFECYCLE_FACTORY))
                     {
                         getDispenser().feedLifecycleFactory(className);
-                    }
-                    else if (factoryName.equals(FactoryFinder.RENDER_KIT_FACTORY))
+                    } else if (factoryName.equals(FactoryFinder.RENDER_KIT_FACTORY))
                     {
                         getDispenser().feedRenderKitFactory(className);
-                    }
-                    else
+                    } else
                     {
                         throw new IllegalStateException("Unexpected factory name " + factoryName);
                     }
@@ -522,11 +532,8 @@
                 facesConfigs.put(systemId, url);
             }
 
-            Iterator<Map.Entry<String, URL>> facesConfigIt = facesConfigs.entrySet().iterator();
-
-            while (facesConfigIt.hasNext())
+            for (Map.Entry<String, URL> entry : facesConfigs.entrySet())
             {
-                Map.Entry<String, URL> entry = facesConfigIt.next();
                 InputStream stream = openStreamWithoutCache(entry.getValue());
                 try
                 {
@@ -749,9 +756,6 @@
                                                                         new VariableResolverImpl()));
     }
 
-    /**
-     * @return
-     */
     protected RuntimeConfig getRuntimeConfig()
     {
         if (_runtimeConfig == null)
@@ -1157,11 +1161,11 @@
         public int hashCode()
         {
             int hash = 0;
-            for (int i = 0; i < parts.length; i++)
+            for (Integer part : parts)
             {
-                if (parts[i] != null)
+                if (part != null)
                 {
-                    hash ^= parts[i].hashCode();
+                    hash ^= part.hashCode();
                 }
             }
 



Mime
View raw message