You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2020/01/27 23:41:29 UTC

[maven-surefire] branch maven2surefire-jvm-communication updated: fixed Surefire946KillMainProcessInReusableForkIT

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 9b0b15d  fixed Surefire946KillMainProcessInReusableForkIT
9b0b15d is described below

commit 9b0b15d89f830bda5bae07add75e9e0ddb721fea
Author: tibordigana <ti...@apache.org>
AuthorDate: Tue Jan 28 00:41:19 2020 +0100

    fixed Surefire946KillMainProcessInReusableForkIT
---
 .../surefire/booter/spi/DefaultMasterProcessChannelDecoder.java  | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/spi/DefaultMasterProcessChannelDecoder.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/spi/DefaultMasterProcessChannelDecoder.java
index 4b363ee..40cf880 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/spi/DefaultMasterProcessChannelDecoder.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/spi/DefaultMasterProcessChannelDecoder.java
@@ -24,6 +24,7 @@ import org.apache.maven.surefire.booter.Command;
 import org.apache.maven.surefire.booter.MasterProcessCommand;
 import org.apache.maven.surefire.providerapi.MasterProcessChannelDecoder;
 
+import java.io.EOFException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
@@ -63,7 +64,8 @@ public class DefaultMasterProcessChannelDecoder implements MasterProcessChannelD
         StringBuilder frame = new StringBuilder();
         boolean frameStarted = false;
         boolean frameFinished = false;
-        for ( int r; ( r = is.read() ) != -1 ; )
+        boolean notEndOfStream;
+        for ( int r; notEndOfStream = ( r = is.read() ) != -1 ; )
         {
             char c = (char) r;
             if ( frameFinished && c == '\n' )
@@ -111,6 +113,11 @@ public class DefaultMasterProcessChannelDecoder implements MasterProcessChannelD
             }
         }
 
+        if ( !notEndOfStream )
+        {
+            throw new EOFException();
+        }
+
         if ( tokens.size() <= 1 )
         {
             throw new MasterProcessCommandNoMagicNumberException( frame.toString() );