logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r1397910 - in /logging/log4j/log4j2/trunk: core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java core/src/test/java/org/apache/logging/log4j/core/lookup/InterpolatorTest.java src/changes/changes.xml
Date Sat, 13 Oct 2012 17:39:44 GMT
Author: rgoers
Date: Sat Oct 13 17:39:44 2012
New Revision: 1397910

URL: http://svn.apache.org/viewvc?rev=1397910&view=rev
Log:
Fix LOG4J2-94 - Interpolator was not stripping Lookup key separator when trying to locate
the default value for a variable.

Modified:
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/lookup/InterpolatorTest.java
    logging/log4j/log4j2/trunk/src/changes/changes.xml

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java?rev=1397910&r1=1397909&r2=1397910&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java
Sat Oct 13 17:39:44 2012
@@ -107,7 +107,7 @@ public class Interpolator implements Str
             if (value != null) {
                 return value;
             }
-            var = var.substring(prefixPos);
+            var = var.substring(prefixPos + 1);
         }
         if (defaultLookup != null) {
             return event == null ? defaultLookup.lookup(var) : defaultLookup.lookup(event,
var);

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/lookup/InterpolatorTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/lookup/InterpolatorTest.java?rev=1397910&r1=1397909&r2=1397910&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/lookup/InterpolatorTest.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/lookup/InterpolatorTest.java
Sat Oct 13 17:39:44 2012
@@ -61,5 +61,8 @@ public class InterpolatorTest {
         assertEquals(TESTVAL, value);
         value = lookup.lookup("BadKey");
         assertNull(value);
+        ThreadContext.clear();
+        value = lookup.lookup("ctx:" + TESTKEY);
+        assertEquals(TESTVAL, value);
     }
 }

Modified: logging/log4j/log4j2/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/changes/changes.xml?rev=1397910&r1=1397909&r2=1397910&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/changes/changes.xml (original)
+++ logging/log4j/log4j2/trunk/src/changes/changes.xml Sat Oct 13 17:39:44 2012
@@ -23,6 +23,9 @@
 
   <body>
     <release version="2.0-beta3" date="TBD" description= "Bug fixes and enhancements">
+      <action issue="LOG4J2-94" dev="rgoers" type="fix" due-to="Denis Treskunov">
+        Interpolator was not stripping Lookup key separator when trying to locate the default
value for a variable.
+      </action>
       <action dev="rgoers" type="fix">
         Log4j 1.2 Category.forcedLog was wrapping the message with an ObjectMessage even
if the parameter was an
         ObjectMessage.



Mime
View raw message