You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2016/04/05 17:53:08 UTC

[16/23] logging-log4j2 git commit: LOG4J2-1343 Update test: When the garbage-free Layout mechanism is used, IOExceptions are wrapped in IllegalStateExceptions.

LOG4J2-1343 Update test: When the garbage-free Layout mechanism is used, IOExceptions are wrapped in IllegalStateExceptions.


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/414e7ca1
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/414e7ca1
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/414e7ca1

Branch: refs/heads/LOG4J2-1343-no-gc-outputstreamappenders
Commit: 414e7ca14e42bbaca968696dab9b76833f18b047
Parents: 36a87ba
Author: rpopma <rp...@apache.org>
Authored: Tue Apr 5 23:16:31 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Tue Apr 5 23:16:31 2016 +0900

----------------------------------------------------------------------
 .../core/net/server/AbstractSocketServerTest.java | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/414e7ca1/log4j-core/src/test/java/org/apache/logging/log4j/core/net/server/AbstractSocketServerTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/net/server/AbstractSocketServerTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/net/server/AbstractSocketServerTest.java
index ee5c2de..a75240b 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/net/server/AbstractSocketServerTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/net/server/AbstractSocketServerTest.java
@@ -36,6 +36,7 @@ import org.apache.logging.log4j.core.layout.JsonLayout;
 import org.apache.logging.log4j.core.layout.PatternLayout;
 import org.apache.logging.log4j.core.layout.XmlLayout;
 import org.apache.logging.log4j.core.net.Protocol;
+import org.apache.logging.log4j.core.util.Constants;
 import org.apache.logging.log4j.test.AvailablePortFinder;
 import org.apache.logging.log4j.test.appender.ListAppender;
 import org.junit.After;
@@ -54,9 +55,9 @@ public abstract class AbstractSocketServerTest {
     private static final String MESSAGE = "This is test message";
 
     private static final String MESSAGE_2 = "This is test message 2";
-    
+
     private static final String MESSAGE_WITH_SPECIAL_CHARS = "{This}\n[is]\"n\"a\"\r\ntrue:\n\ttest,\nmessage";
-    
+
     static final int PORT_NUM = AvailablePortFinder.getNextAvailable();
 
     static final int PORT = PORT_NUM;
@@ -138,20 +139,25 @@ public abstract class AbstractSocketServerTest {
             try {
                 testServer(m1, m2);
             } catch (final AppenderLoggingException are) {
-                assertTrue("", are.getCause() != null && are.getCause() instanceof IOException);
+                if (Constants.ENABLE_DIRECT_ENCODERS) {
+                    IllegalStateException ex = (IllegalStateException) are.getCause();
+                    assertTrue("" + ex.getCause(), ex.getCause() != null && ex.getCause() instanceof IOException);
+                } else {
+                    assertTrue("" + are.getCause(), are.getCause() != null && are.getCause() instanceof IOException);
+                }
                 // Failure expected.
             }
         } else {
             testServer(m1, m2);
         }
     }
-    
-    
+
+
     @Test
     public void testMessagesWithSpecialChars() throws Exception {
         testServer(MESSAGE_WITH_SPECIAL_CHARS);
     }
-    
+
 
     private void testServer(final int size) throws Exception {
         final String[] messages = new String[size];