IIRC our Strings utility class has an isEmpty method for this pattern. Gary
<div>-------- Original message --------</div><div>From: [email protected] </div><div>Date:08/10/2014 03:09 (GMT-05:00) </div><div>To: [email protected] </div><div>Subject: svn commit: r1617053 - in /logging/log4j/log4j2/trunk: log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/PluginManager.java src/changes/changes.xml </div><div> </div>Author: rpopma Date: Sun Aug 10 07:09:36 2014 New Revision: 1617053 URL: http://svn.apache.org/r1617053 Log: LOG4J2-769 Startup takes a long time if you have empty packages attribute. Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/PluginManager.java logging/log4j/log4j2/trunk/src/changes/changes.xml 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=1617053&r1=1617052&r2=1617053&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 Sun Aug 10 07:09:36 2014 @@ -81,9 +81,12 @@ public class PluginManager { /** * Adds a package name to be scanned for plugins. Must be invoked prior to plugins being collected. * - * @param p The package name. + * @param p The package name. Ignored if {@code null} or empty. */ public static void addPackage(final String p) { + if (p == null || p.isEmpty()) { + return; + } if (PACKAGES.addIfAbsent(p)) { // set of available plugins could have changed, reset plugin cache for newly-retrieved managers REGISTRY.clear(); // TODO confirm if this is correct Modified: logging/log4j/log4j2/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/changes/changes.xml?rev=1617053&r1=1617052&r2=1617053&view=diff ============================================================================== --- logging/log4j/log4j2/trunk/src/changes/changes.xml (original) +++ logging/log4j/log4j2/trunk/src/changes/changes.xml Sun Aug 10 07:09:36 2014 @@ -22,33 +22,36 @@ </properties> <body> <release version="2.0.2" date="2014-0?-??" description="Bug fixes and enhancements"> + <action issue="LOG4J2-769" dev="rpopma" type="fix" due-to="Scott Harrington"> + Startup takes a long time if you have empty packages attribute. + </action> <action issue="LOG4J2-763" dev="rpopma" type="fix"> Improved FormattedMessage, StringFormattedMessage, LocalizedMessage, MessageFormatMessage and ObjectMessage for asynchronous logging to ensure the formatted message does not change even if parameters are modified by the application. (ParameterizedMessage was already safe.) Improved documentation. - </action> + </action> <action issue="LOG4J2-729" dev="rpopma" type="fix"> Emit warning message to console if no configuration file found. - </action> + </action> <action issue="LOG4J2-765" dev="rpopma" type="fix"> Improve warning message when missing log4j-core in the classpath. - </action> + </action> <action issue="LOG4J2-722" dev="rpopma" type="fix"> Clarified in documentation that Commons Logging jar is required when using log4j-jcl. - </action> + </action> <action issue="LOG4J2-723" dev="rpopma" type="fix"> Clarified in documentation that SLF4J API jar is required when using log4j-slf4j-impl. - </action> + </action> <action issue="LOG4J2-730" dev="rpopma" type="update"> Allow Log4jContextFactory subclasses to specify a custom ContextSelector. - </action> + </action> <action issue="LOG4J2-759" dev="rpopma" type="fix"> Fixed various minor site/documentation issues, mostly versioning related. - </action> + </action> <action issue="LOG4J2-756" dev="rpopma" type="fix" due-to="Scott Harrington"> Prevent JUnit test from creating unnecessary Log4j2Plugins.dat during build. - </action> + </action> </release> <release version="2.0.1" date="2014-07-29" description="Bug fixes"> <action issue="LOG4J2-744" dev="rpopma" type="fix" due-to="Scott Harrington">
