logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattsic...@apache.org
Subject svn commit: r1587348 - /logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/util/ProviderUtil.java
Date Mon, 14 Apr 2014 22:38:44 GMT
Author: mattsicker
Date: Mon Apr 14 22:38:43 2014
New Revision: 1587348

URL: http://svn.apache.org/r1587348
Log:
Weaken List to Collection and others.

  - Narrow scope of Properties instance.
  - Use isEmpty

Modified:
    logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/util/ProviderUtil.java

Modified: logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/util/ProviderUtil.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/util/ProviderUtil.java?rev=1587348&r1=1587347&r2=1587348&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/util/ProviderUtil.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/util/ProviderUtil.java
Mon Apr 14 22:38:43 2014
@@ -19,11 +19,10 @@ package org.apache.logging.log4j.util;
 import java.io.IOException;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Enumeration;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Properties;
-
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.spi.Provider;
 import org.apache.logging.log4j.status.StatusLogger;
@@ -42,7 +41,7 @@ public final class ProviderUtil {
 
     private static final Logger LOGGER = StatusLogger.getLogger();
 
-    private static final List<Provider> PROVIDERS = new ArrayList<Provider>();
+    private static final Collection<Provider> PROVIDERS = new ArrayList<Provider>();
 
     private ProviderUtil() {
     }
@@ -59,9 +58,8 @@ public final class ProviderUtil {
         if (enumResources != null) {
             while (enumResources.hasMoreElements()) {
                 final URL url = enumResources.nextElement();
-                Properties props;
                 try {
-                    props = PropertiesUtil.loadClose(url.openStream(), url);
+                    final Properties props = PropertiesUtil.loadClose(url.openStream(), url);
                     if (!validVersion(props.getProperty(API_VERSION))) {
                         continue;
                     }
@@ -78,7 +76,7 @@ public final class ProviderUtil {
     }
 
     public static boolean hasProviders() {
-        return PROVIDERS.size() > 0;
+        return !PROVIDERS.isEmpty();
     }
 
     public static ClassLoader findClassLoader() {



Mime
View raw message