This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch maven2surefire-jvm-communication
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
The following commit(s) were added to
refs/heads/maven2surefire-jvm-communication by this push:
new 0884872 not using UncaughtExceptionHandler in ForkChannelTest
0884872 is described below
commit 088487206279081847e3dac13975f1244fad299d
Author: tibordigana <[email protected]>
AuthorDate: Sat Feb 15 18:15:45 2020 +0100
not using UncaughtExceptionHandler in ForkChannelTest
---
.../maven/surefire/extensions/ForkChannelTest.java | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git
a/maven-surefire-common/src/test/java/org/apache/maven/surefire/extensions/ForkChannelTest.java
b/maven-surefire-common/src/test/java/org/apache/maven/surefire/extensions/ForkChannelTest.java
index 9ecc19c..db68417 100644
---
a/maven-surefire-common/src/test/java/org/apache/maven/surefire/extensions/ForkChannelTest.java
+++
b/maven-surefire-common/src/test/java/org/apache/maven/surefire/extensions/ForkChannelTest.java
@@ -26,7 +26,6 @@ import
org.apache.maven.surefire.shared.utils.cli.StreamConsumer;
import org.junit.Test;
import java.io.IOException;
-import java.lang.Thread.UncaughtExceptionHandler;
import java.net.Socket;
import java.net.URI;
import java.util.Queue;
@@ -44,6 +43,8 @@ public class ForkChannelTest
{
private static final long TESTCASE_TIMEOUT = 30_000L;
+ private final AtomicBoolean hasError = new AtomicBoolean();
+
@Test( timeout = TESTCASE_TIMEOUT )
public void shouldRequestReplyMessagesViaTCP() throws Exception
{
@@ -71,16 +72,6 @@ public class ForkChannelTest
Consumer consumer = new Consumer();
Client client = new Client( uri.getPort() );
- final AtomicBoolean hasError = new AtomicBoolean();
- client.setUncaughtExceptionHandler( new UncaughtExceptionHandler()
- {
- @Override
- public void uncaughtException( Thread t, Throwable e )
- {
- hasError.set( true );
- e.printStackTrace( System.err );
- }
- } );
client.start();
channel.connectToClient();
@@ -116,7 +107,7 @@ public class ForkChannelTest
}
}
- private static class Client extends Thread
+ private final class Client extends Thread
{
private final int port;
@@ -138,9 +129,16 @@ public class ForkChannelTest
}
catch ( IOException e )
{
+ hasError.set( true );
e.printStackTrace();
throw new IllegalStateException( e );
}
+ catch ( RuntimeException e )
+ {
+ hasError.set( true );
+ e.printStackTrace();
+ throw e;
+ }
}
}
}