[maven-surefire] branch maven2surefire-jvm-communication updated: improved the loop

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[maven-surefire] branch maven2surefire-jvm-communication updated: improved the loop

Tibor Digana
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 f7853e4  improved the loop
f7853e4 is described below

commit f7853e49f54207daf99bf642b6151acfac9ca426
Author: tibordigana <[hidden email]>
AuthorDate: Sat Nov 9 04:51:48 2019 +0100

    improved the loop
---
 .../plugin/surefire/extensions/NetworkingProcessExecutor.java     | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/NetworkingProcessExecutor.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/NetworkingProcessExecutor.java
index 8e8b7d7..0d5c454 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/NetworkingProcessExecutor.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/NetworkingProcessExecutor.java
@@ -109,13 +109,17 @@ final class NetworkingProcessExecutor implements ExecutableCommandline
                 executorService.submit( new Runnable()
                 {
                     @Override
-                    @SuppressWarnings( "checkstyle:innerassignment" )
                     public void run()
                     {
                         try
                         {
-                            for ( Command cmd; ( cmd = commands.readNextCommand() ) != null;  )
+                            for ( Command cmd; !commands.isClosed();  )
                             {
+                                cmd = commands.readNextCommand();
+                                if ( cmd == null )
+                                {
+                                    break;
+                                }
                                 MasterProcessCommand cmdType = cmd.getCommandType();
                                 byte[] b = cmdType.hasDataType() ? cmdType.encode( cmd.getData() ) : cmdType.encode();
                                 ByteBuffer bb = wrap( b );