From 72b1841f5cecc5ff393ce75f6d42af423ddcb4ed Mon Sep 17 00:00:00 2001 From: "tibor.digana" Date: Wed, 13 Apr 2022 02:28:26 +0200 Subject: [PATCH] Refactored decode(Memento) and embedded Memento in the decoder instance --- .../surefire/extensions/EventConsumerThread.java | 4 +--- .../apache/maven/surefire/stream/EventDecoder.java | 11 ++++++++++- .../surefire/api/stream/AbstractStreamDecoder.java | 10 +++++++++- .../api/stream/MalformedChannelException.java | 2 +- .../api/stream/AbstractStreamDecoderTest.java | 2 +- .../surefire/booter/spi/CommandChannelDecoder.java | 11 +---------- .../maven/surefire/booter/stream/CommandDecoder.java | 10 +++++++++- 7 files changed, 32 insertions(+), 18 deletions(-) diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/EventConsumerThread.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/EventConsumerThread.java index 79d5c85ab1..2e5b5d3f20 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/EventConsumerThread.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/EventConsumerThread.java @@ -21,7 +21,6 @@ import org.apache.maven.surefire.api.event.Event; import org.apache.maven.surefire.api.fork.ForkNodeArguments; -import org.apache.maven.surefire.api.stream.AbstractStreamDecoder.Memento; import org.apache.maven.surefire.extensions.CloseableDaemonThread; import org.apache.maven.surefire.extensions.EventHandler; import org.apache.maven.surefire.extensions.util.CountdownCloseable; @@ -67,10 +66,9 @@ public void run() CountdownCloseable c = countdownCloseable; EventDecoder eventDecoder = decoder ) { - Memento memento = eventDecoder.new Memento(); do { - Event event = eventDecoder.decode( memento ); + Event event = eventDecoder.decode(); if ( event != null && !disabled ) { eventHandler.handleEvent( event ); diff --git a/maven-surefire-common/src/main/java/org/apache/maven/surefire/stream/EventDecoder.java b/maven-surefire-common/src/main/java/org/apache/maven/surefire/stream/EventDecoder.java index ea11889846..fa61d491ef 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/surefire/stream/EventDecoder.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/surefire/stream/EventDecoder.java @@ -140,6 +140,8 @@ public class EventDecoder extends AbstractStreamDecoder