You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2015/09/17 17:17:48 UTC

logging-log4j2 git commit: Bullet-proof code and check for blank strings in addition to null for configLocation. Additional Javadoc for allowed nulls and blanks.

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 97d90296e -> 8cff8945f


Bullet-proof code and check for blank strings in addition to null for
configLocation. Additional Javadoc for allowed nulls and blanks.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/8cff8945
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/8cff8945
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/8cff8945

Branch: refs/heads/master
Commit: 8cff8945f4142fdb9e6addafeb13a67208c45902
Parents: 97d9029
Author: ggregory <gg...@apache.org>
Authored: Thu Sep 17 08:17:41 2015 -0700
Committer: ggregory <gg...@apache.org>
Committed: Thu Sep 17 08:17:41 2015 -0700

----------------------------------------------------------------------
 .../org/apache/logging/log4j/core/config/Configurator.java  | 9 ++++-----
 .../apache/logging/log4j/core/impl/Log4jContextFactory.java | 2 +-
 2 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8cff8945/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java
index 7b138b1..de69d1f 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java
@@ -104,15 +104,14 @@ public final class Configurator {
      * Initializes the Logging Context.
      * @param name The Context name.
      * @param loader The ClassLoader for the Context (or null).
-     * @param configLocation The configuration for the logging context.
+     * @param configLocation The configuration for the logging context (or null, or blank).
      * @param externalContext The external context to be attached to the LoggerContext
      * @return The LoggerContext or null if an error occurred (check the status logger).
      */
     public static LoggerContext initialize(final String name, final ClassLoader loader, final String configLocation,
-                                           final Object externalContext) {
-
+            final Object externalContext) {
         try {
-            final URI uri = configLocation == null ? null : FileUtils.getCorrectedFilePathUri(configLocation);
+            final URI uri = Strings.isBlank(configLocation) ? null : FileUtils.getCorrectedFilePathUri(configLocation);
             return initialize(name, loader, uri, externalContext);
         } catch (final URISyntaxException ex) {
             LOGGER.error("There was a problem parsing the configuration location [{}].", configLocation, ex);
@@ -135,7 +134,7 @@ public final class Configurator {
      * Initializes the Logging Context.
      * @param name The Context name.
      * @param loader The ClassLoader for the Context (or null).
-     * @param configLocation The configuration for the logging context.
+     * @param configLocation The configuration for the logging context (or null).
      * @param externalContext The external context to be attached to the LoggerContext
      * @return The LoggerContext.
      */

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8cff8945/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jContextFactory.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jContextFactory.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jContextFactory.java
index e88faae..5c6ebfe 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jContextFactory.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jContextFactory.java
@@ -212,7 +212,7 @@ public class Log4jContextFactory implements LoggerContextFactory, ShutdownCallba
      * @param externalContext An external context (such as a ServletContext) to be associated with the LoggerContext.
      * @param currentContext If true returns the current Context, if false returns the Context appropriate
      * for the caller if a more appropriate Context can be determined.
-     * @param configLocation The location of the configuration for the LoggerContext.
+     * @param configLocation The location of the configuration for the LoggerContext (or null).
      * @return The LoggerContext.
      */
     @Override