[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v0.9.18-96-gea6065c

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Thu Mar 18 21:50:26 CET 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".

The branch, master has been updated
       via  ea6065ca315b78c7e0eb40d3fe85faec6441a834 (commit)
      from  821d05c90831d9f07d00bbc3f004561c37c1a0c0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=ea6065ca315b78c7e0eb40d3fe85faec6441a834
http://github.com/ceki/logback/commit/ea6065ca315b78c7e0eb40d3fe85faec6441a834

commit ea6065ca315b78c7e0eb40d3fe85faec6441a834
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Thu Mar 18 21:49:40 2010 +0100

    - have all tests pass

diff --git a/logback-core/src/main/java/ch/qos/logback/core/pattern/parser/Parser.java b/logback-core/src/main/java/ch/qos/logback/core/pattern/parser/Parser.java
index c0321f0..268edea 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/pattern/parser/Parser.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/pattern/parser/Parser.java
@@ -41,7 +41,7 @@ public class Parser<E> extends ContextAwareBase {
     try {
       TokenStream ts = new TokenStream(pattern, escapeUtil);
       this.tokenList = ts.tokenize();
-    } catch (NullPointerException npe) {
+    } catch (IllegalArgumentException npe) {
       throw new ScanException("Failed to initialize Parser", npe);
     }
   }
diff --git a/logback-core/src/main/java/ch/qos/logback/core/pattern/parser/TokenStream.java b/logback-core/src/main/java/ch/qos/logback/core/pattern/parser/TokenStream.java
index d5080d5..b0dc881 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/pattern/parser/TokenStream.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/pattern/parser/TokenStream.java
@@ -20,24 +20,29 @@ import ch.qos.logback.core.CoreConstants;
 import ch.qos.logback.core.pattern.util.IEscapeUtil;
 import ch.qos.logback.core.pattern.util.RegularEscapeUtil;
 
-
-
 /**
- * <p>Return a steady stream of tokens. <p/>
+ * <p>
+ * Return a steady stream of tokens.
+ * <p/>
  * 
- * <p>The returned tokens are one of:
- * LITERAL, '%', FORMAT_MODIFIER, KEYWWORD, OPTION, LEFT_PARENTHESIS, and
- * RIGHT_PARENTHESIS.</p>
+ * <p>
+ * The returned tokens are one of: LITERAL, '%', FORMAT_MODIFIER, KEYWWORD,
+ * OPTION, LEFT_PARENTHESIS, and RIGHT_PARENTHESIS.
+ * </p>
  * 
- * <p>The '\' character is used as escape. It can be used to escape '_', '%', '(' and 
- * '('.<p>
+ * <p>
+ * The '\' character is used as escape. It can be used to escape '_', '%', '('
+ * and '('.
+ * <p>
  * 
- * <p>Note that there is no EOS token returned.</p>
+ * <p>
+ * Note that there is no EOS token returned.
+ * </p>
  */
 class TokenStream {
 
   private static final char ESCAPE_CHAR = '\\';
-  private static final char PERCENT_CHAR = CoreConstants.PERCENT_CHAR; 
+  private static final char PERCENT_CHAR = CoreConstants.PERCENT_CHAR;
   private static final char CURLY_LEFT = '{';
   private static final char CURLY_RIGHT = '}';
 
@@ -49,7 +54,7 @@ class TokenStream {
   final String pattern;
   final int patternLength;
   final IEscapeUtil escapeUtil;
-  
+
   int state = LITERAL_STATE;
   int pointer = 0;
 
@@ -57,10 +62,11 @@ class TokenStream {
   TokenStream(String pattern) {
     this(pattern, new RegularEscapeUtil());
   }
-  
+
   TokenStream(String pattern, IEscapeUtil escapeUtil) {
-    if(pattern == null || pattern.length() == 0) {
-      throw new NullPointerException("null or empty pattern string not allowed");
+    if (pattern == null || pattern.length() == 0) {
+      throw new IllegalArgumentException(
+          "null or empty pattern string not allowed");
     }
     this.pattern = pattern;
     patternLength = pattern.length();
diff --git a/logback-core/src/test/java/ch/qos/logback/core/appender/AbstractAppenderTest.java b/logback-core/src/test/java/ch/qos/logback/core/appender/AbstractAppenderTest.java
index 60457c8..826194a 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/appender/AbstractAppenderTest.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/appender/AbstractAppenderTest.java
@@ -55,6 +55,7 @@ abstract public class AbstractAppenderTest<E>  {
   @Test
   public void testNoStart() {
     Appender<E> appender = getAppender();
+    appender.setContext(context);
     appender.setName("doh");
     // is null OK?
     appender.doAppend(null);
diff --git a/logback-core/src/test/java/ch/qos/logback/core/appender/ConsoleAppenderTest.java b/logback-core/src/test/java/ch/qos/logback/core/appender/ConsoleAppenderTest.java
index 74bdd80..a4e5063 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/appender/ConsoleAppenderTest.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/appender/ConsoleAppenderTest.java
@@ -61,9 +61,7 @@ public class ConsoleAppenderTest extends AbstractAppenderTest<Object> {
 
   @Override
   public Appender<Object> getAppender() {
-    ConsoleAppender<Object> ca = new ConsoleAppender<Object>();
-    ca.setContext(context);
-    return ca;
+    return  new ConsoleAppender<Object>();
   }
 
   protected Appender<Object> getConfiguredAppender() {
diff --git a/logback-core/src/test/java/ch/qos/logback/core/appender/FileAppenderTest.java b/logback-core/src/test/java/ch/qos/logback/core/appender/FileAppenderTest.java
index 0c3f5d1..d3022ed 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/appender/FileAppenderTest.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/appender/FileAppenderTest.java
@@ -19,26 +19,23 @@ import static org.junit.Assert.assertTrue;
 
 import java.io.File;
 import java.util.List;
-import java.util.Random;
 
 import org.junit.Test;
 
 import ch.qos.logback.core.Appender;
-import ch.qos.logback.core.Context;
-import ch.qos.logback.core.ContextBase;
 import ch.qos.logback.core.FileAppender;
 import ch.qos.logback.core.encoder.DummyEncoder;
 import ch.qos.logback.core.encoder.NopEncoder;
 import ch.qos.logback.core.status.Status;
 import ch.qos.logback.core.status.StatusManager;
+import ch.qos.logback.core.testUtil.RandomUtil;
 import ch.qos.logback.core.util.CoreTestConstants;
 import ch.qos.logback.core.util.FileUtil;
 import ch.qos.logback.core.util.StatusPrinter;
 
 public class FileAppenderTest extends AbstractAppenderTest<Object> {
 
-  int diff = new Random().nextInt(100);
-  Context context = new ContextBase();
+  int diff = RandomUtil.getPositiveInt();
 
   protected Appender<Object> getAppender() {
     return new FileAppender<Object>();
diff --git a/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/TokenStreamTest.java b/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/TokenStreamTest.java
index 4ce47ce..d737a56 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/TokenStreamTest.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/TokenStreamTest.java
@@ -13,9 +13,8 @@
  */
 package ch.qos.logback.core.pattern.parser;
 
-
-
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -24,14 +23,15 @@ import org.junit.Test;
 
 import ch.qos.logback.core.pattern.util.AlmostAsIsEscapeUtil;
 
-public class TokenStreamTest  {
-
+public class TokenStreamTest {
 
   @Test
   public void testEmpty() throws ScanException {
-    List tl = new TokenStream("").tokenize();
-    List witness = new ArrayList();
-    assertEquals(witness, tl);
+    try {
+      new TokenStream("").tokenize();
+      fail("empty string not allowed");
+    } catch (IllegalArgumentException e) {
+    }
   }
 
   @Test
@@ -330,8 +330,8 @@ public class TokenStreamTest  {
   @Test
   public void testWindowsLikeBackSlashes() throws ScanException {
     {
-      List tl = new TokenStream("c:\\hello\\world.%i", new AlmostAsIsEscapeUtil())
-          .tokenize();
+      List tl = new TokenStream("c:\\hello\\world.%i",
+          new AlmostAsIsEscapeUtil()).tokenize();
 
       List<Token> witness = new ArrayList<Token>();
       witness.add(new Token(Token.LITERAL, "c:\\hello\\world."));
diff --git a/logback-core/src/test/java/ch/qos/logback/core/rolling/PackageTest.java b/logback-core/src/test/java/ch/qos/logback/core/rolling/PackageTest.java
index ecc934b..94e8ca5 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/rolling/PackageTest.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/rolling/PackageTest.java
@@ -21,6 +21,7 @@ import org.junit.runners.Suite;
     TimeBasedRollingTest.class, TimeBasedRollingWithArchiveRemovalTest.class,
     MultiThreadedRollingTest.class,
     SizeAndTimeBasedFNATP_Test.class,
+    RollingFileAppenderTest.class,
     ch.qos.logback.core.rolling.helper.PackageTest.class })
 public class PackageTest {
 }

-----------------------------------------------------------------------

Summary of changes:
 .../ch/qos/logback/core/pattern/parser/Parser.java |    2 +-
 .../logback/core/pattern/parser/TokenStream.java   |   34 +++++++++++--------
 .../core/appender/AbstractAppenderTest.java        |    1 +
 .../logback/core/appender/ConsoleAppenderTest.java |    4 +--
 .../logback/core/appender/FileAppenderTest.java    |    7 +---
 .../core/pattern/parser/TokenStreamTest.java       |   18 +++++-----
 .../ch/qos/logback/core/rolling/PackageTest.java   |    1 +
 7 files changed, 35 insertions(+), 32 deletions(-)


hooks/post-receive
-- 
Logback: the generic, reliable, fast and flexible logging framework.


More information about the logback-dev mailing list