You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2016/03/12 18:57:01 UTC
logging-log4j2 git commit: Return null instead of "null".
Repository: logging-log4j2
Updated Branches:
refs/heads/master 5bd76ac1e -> 9d0dbe4a6
Return null instead of "null".
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/9d0dbe4a
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/9d0dbe4a
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/9d0dbe4a
Branch: refs/heads/master
Commit: 9d0dbe4a65d110c84aee9251d21642498c1cc413
Parents: 5bd76ac
Author: Matt Sicker <bo...@gmail.com>
Authored: Sat Mar 12 11:55:13 2016 -0600
Committer: Matt Sicker <bo...@gmail.com>
Committed: Sat Mar 12 11:55:13 2016 -0600
----------------------------------------------------------------------
.../java/org/apache/logging/log4j/core/lookup/JndiLookup.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9d0dbe4a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/JndiLookup.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/JndiLookup.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/JndiLookup.java
index 1cd4290..3ceed5d 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/JndiLookup.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/JndiLookup.java
@@ -42,7 +42,7 @@ public class JndiLookup extends AbstractLookup {
* Looks up the value of the JNDI resource.
* @param event The current LogEvent (is ignored by this StrLookup).
* @param key the JNDI resource name to be looked up, may be null
- * @return The value of the JNDI resource.
+ * @return The String value of the JNDI resource.
*/
@Override
public String lookup(final LogEvent event, final String key) {
@@ -52,7 +52,8 @@ public class JndiLookup extends AbstractLookup {
final String jndiName = convertJndiName(key);
final JndiManager jndiManager = JndiManager.getDefaultManager();
try {
- return String.valueOf(jndiManager.lookup(jndiName));
+ final Object value = jndiManager.lookup(jndiName);
+ return value == null ? null : String.valueOf(value);
} catch (final NamingException e) {
LOGGER.warn(LOOKUP, "Error looking up JNDI resource [{}].", jndiName, e);
return null;