Author: rgoers
Date: Mon Mar 26 04:57:16 2012
New Revision: 1305223

URL: http://svn.apache.org/viewvc?rev=1305223&view=rev
Log:
Fix OutputStreamAppenderTest and HTMLLayoutTest on Windows

Modified:
    
logging/log4j/log4j2/trunk/log4j2-core/src/test/java/org/apache/logging/log4j/core/appender/OutputStreamAppenderTest.java
    
logging/log4j/log4j2/trunk/log4j2-core/src/test/java/org/apache/logging/log4j/test/appender/ListAppender.java

Modified: 
logging/log4j/log4j2/trunk/log4j2-core/src/test/java/org/apache/logging/log4j/core/appender/OutputStreamAppenderTest.java
URL: 
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j2-core/src/test/java/org/apache/logging/log4j/core/appender/OutputStreamAppenderTest.java?rev=1305223&r1=1305222&r2=1305223&view=diff
==============================================================================
--- 
logging/log4j/log4j2/trunk/log4j2-core/src/test/java/org/apache/logging/log4j/core/appender/OutputStreamAppenderTest.java
 (original)
+++ 
logging/log4j/log4j2/trunk/log4j2-core/src/test/java/org/apache/logging/log4j/core/appender/OutputStreamAppenderTest.java
 Mon Mar 26 04:57:16 2012
@@ -35,6 +35,7 @@ import static org.junit.Assert.assertEqu
  */
 public class OutputStreamAppenderTest {
 
+    private static final String LINE_SEP = 
System.getProperty("line.separator");
 
     @Test
     public void testAppender() {
@@ -46,9 +47,8 @@ public class OutputStreamAppenderTest {
         assertTrue("Appender did not start", app.isStarted());
         app.append(event);
         String msg = app.toString();
-        System.out.println("\"" + msg + "\"");
         assertNotNull("No message", msg);
-        assertTrue("Incorrect message: " + msg , msg.endsWith("Test\n") || 
msg.endsWith("Test\r\n"));
+        assertTrue("Incorrect message: " + msg , msg.endsWith("Test" + 
LINE_SEP));
         app.stop();
         assertFalse("Appender did not stop", app.isStarted());
     }

Modified: 
logging/log4j/log4j2/trunk/log4j2-core/src/test/java/org/apache/logging/log4j/test/appender/ListAppender.java
URL: 
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j2-core/src/test/java/org/apache/logging/log4j/test/appender/ListAppender.java?rev=1305223&r1=1305222&r2=1305223&view=diff
==============================================================================
--- 
logging/log4j/log4j2/trunk/log4j2-core/src/test/java/org/apache/logging/log4j/test/appender/ListAppender.java
 (original)
+++ 
logging/log4j/log4j2/trunk/log4j2-core/src/test/java/org/apache/logging/log4j/test/appender/ListAppender.java
 Mon Mar 26 04:57:16 2012
@@ -46,6 +46,8 @@ public class ListAppender extends Append
     private final boolean newLine;
 
     private final boolean raw;
+    
+    private static final String LINE_SEP = 
System.getProperty("line.separator");
 
     public ListAppender(String name) {
         super(name, null, null);
@@ -90,9 +92,9 @@ public class ListAppender extends Append
         if (newLine) {
             int index = 0;
             while (index < str.length()) {
-                int end = str.indexOf("\n", index);
+                int end = str.indexOf(LINE_SEP, index);
                 if (index == end) {
-                    if (!messages.get(messages.size() - 1).equals("")) {
+                    if (!messages.get(messages.size() - 
LINE_SEP.length()).equals("")) {
                         messages.add("");
                     }
                 } else if (end >= 0) {
@@ -101,7 +103,7 @@ public class ListAppender extends Append
                     messages.add(str.substring(index));
                     break;
                 }
-                index = end + 1;
+                index = end + LINE_SEP.length();
             }
         } else {
             messages.add(str);


Reply via email to