[slf4j-dev] svn commit: r1288 - in slf4j/trunk/slf4j-ext/src: main/java/org/slf4j/ext test/java/org/slf4j/dummyExt

rgoers at slf4j.org rgoers at slf4j.org
Fri Mar 20 07:21:04 CET 2009


Author: rgoers
Date: Fri Mar 20 07:21:04 2009
New Revision: 1288

Modified:
   slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/ext/XLogger.java
   slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/dummyExt/XLoggerTest.java

Log:
Fix bug 130 - ArrayIndexOutOfBoundsException in entry() if 5 arguments specified

Modified: slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/ext/XLogger.java
==============================================================================
--- slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/ext/XLogger.java	(original)
+++ slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/ext/XLogger.java	Fri Mar 20 07:21:04 2009
@@ -93,7 +93,7 @@
   public void entry(Object... argArray) {
     if (instanceofLAL && logger.isTraceEnabled(ENTRY_MARKER)) {
       String messagePattern = null;
-      if (argArray.length <= ENTRY_MESSAGE_ARRAY_LEN) {
+      if (argArray.length < ENTRY_MESSAGE_ARRAY_LEN) {
         messagePattern = ENTRY_MESSAGE_ARRAY[argArray.length];
       } else {
         messagePattern = buildMessagePattern(argArray.length);

Modified: slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/dummyExt/XLoggerTest.java
==============================================================================
--- slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/dummyExt/XLoggerTest.java	(original)
+++ slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/dummyExt/XLoggerTest.java	Fri Mar 20 07:21:04 2009
@@ -79,8 +79,11 @@
     logger.entry();
     logger.entry(1);
     logger.entry("test");
+    logger.entry("a", "b", "c", "d");
+    logger.entry("a", "b", "c", "d", "e");
+    logger.entry("a", "b", "c", "d", "e", "f");
 
-    assertEquals(3, listAppender.list.size());
+    assertEquals(6, listAppender.list.size());
     verify((LoggingEvent) listAppender.list.get(0), "entry");
     verify((LoggingEvent) listAppender.list.get(1), "entry with (1)");
     verify((LoggingEvent) listAppender.list.get(2), "entry with (test)");
@@ -130,7 +133,7 @@
   // See http://bugzilla.slf4j.org/show_bug.cgi?id=114
   public void testLocationExtraction_Bug114() {
     XLogger logger = XLoggerFactory.getXLogger("UnitTest");
-    int line = 134; // next line is line number 134
+    int line = 137; // next line is line number 134
     logger.exit(); 
     logger.debug("hello");
 



More information about the slf4j-dev mailing list