You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2014/08/11 16:26:01 UTC
svn commit: r1617295 -
/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/PluginManager.java
Author: rpopma
Date: Mon Aug 11 14:26:00 2014
New Revision: 1617295
URL: http://svn.apache.org/r1617295
Log:
LOG4J2-769: also exclude empty package names from new method {{addPackages(Collection)}}.
Modified:
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/PluginManager.java
Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/PluginManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/PluginManager.java?rev=1617295&r1=1617294&r2=1617295&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/PluginManager.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/PluginManager.java Mon Aug 11 14:26:00 2014
@@ -39,6 +39,7 @@ import org.apache.logging.log4j.core.uti
import org.apache.logging.log4j.core.util.Loader;
import org.apache.logging.log4j.core.util.ResourceLoader;
import org.apache.logging.log4j.status.StatusLogger;
+import org.apache.logging.log4j.util.Strings;
/**
* Loads and manages all the plugins.
@@ -87,7 +88,7 @@ public class PluginManager {
* @param p The package name. Ignored if {@code null} or empty.
*/
public static void addPackage(final String p) {
- if (p == null || p.isEmpty()) {
+ if (Strings.isBlank(p)) {
return;
}
if (PACKAGES.addIfAbsent(p)) {
@@ -99,13 +100,14 @@ public class PluginManager {
/**
* Adds a list of package names to be scanned for plugins. Convenience method for {@link #addPackage(String)}.
*
- * @param packages collection of package names to add. Ignored if {@code null} or empty.
+ * @param packages collection of package names to add. Empty and null package names are ignored.
*/
public static void addPackages(final Collection<String> packages) {
- if (packages == null || packages.isEmpty()) {
- return;
+ for (String pkg : packages) {
+ if (Strings.isNotBlank(pkg)) {
+ PACKAGES.addIfAbsent(pkg);
+ }
}
- PACKAGES.addAllAbsent(packages);
}
/**