[exo-jcr-commits] exo-jcr SVN: r5999 - kernel/branches/2.3.x/patch/2.3.8-GA/KER-183.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Mar 30 09:15:05 EDT 2012


Author: andrew.plotnikov
Date: 2012-03-30 09:15:05 -0400 (Fri, 30 Mar 2012)
New Revision: 5999

Modified:
   kernel/branches/2.3.x/patch/2.3.8-GA/KER-183/KER-183.patch
Log:
KER-183: update patch

Modified: kernel/branches/2.3.x/patch/2.3.8-GA/KER-183/KER-183.patch
===================================================================
--- kernel/branches/2.3.x/patch/2.3.8-GA/KER-183/KER-183.patch	2012-03-30 13:10:43 UTC (rev 5998)
+++ kernel/branches/2.3.x/patch/2.3.8-GA/KER-183/KER-183.patch	2012-03-30 13:15:05 UTC (rev 5999)
@@ -2,14 +2,17 @@
 ===================================================================
 --- exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestLogMessageFormatter.java	(revision 5990)
 +++ exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestLogMessageFormatter.java	(working copy)
-@@ -57,4 +57,17 @@
+@@ -57,4 +57,20 @@
        assertEquals(t, LogMessageFormatter.getThrowable(new Object(), t));
        assertEquals(t, LogMessageFormatter.getThrowable("Just testing{}", new Object(), t));
     }
 +
-+   public void testMessageIsNull() throws Exception
++   public void testGetMessage() throws Exception
 +   {
++      //if object.toString return null
 +      LogMessageFormatter.getMessage("Hello, World {} ", new A());
++      //if object is null
++      LogMessageFormatter.getMessage("Hello, World {} {}", new Object(), null);
 +   }
 +
 +   class A
@@ -24,12 +27,20 @@
 ===================================================================
 --- exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/LogMessageFormatter.java	(revision 5990)
 +++ exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/LogMessageFormatter.java	(working copy)
-@@ -41,13 +41,11 @@
+@@ -34,20 +34,18 @@
+ 
+    public static String getMessage(String str, Object... argsArray)
+    {
+-
+       if (argsArray != null && argsArray.length > 0)
+       {
+          for (int i = 0; i < argsArray.length; i++)
           {
              if (i != argsArray.length - 1 || !(argsArray[i] instanceof Throwable))
              {
 -               str = REPLACE_PATTERN.matcher(str).replaceFirst(String.valueOf(argsArray[i]));
-+               str = REPLACE_PATTERN.matcher(str).replaceFirst(String.valueOf(argsArray[i].toString()));
++               String message = String.valueOf(argsArray[i]);
++               str = REPLACE_PATTERN.matcher(str).replaceFirst(message != null ? message : "null");
              }
           }
        }



More information about the exo-jcr-commits mailing list