Buggy code:
public final class ProcessControllerServerHandler implements ConnectionHandler { private final ProcessController processController ; public ProcessControllerServerHandler ( final ProcessController controller ) { } public MessageHandler handleConnected ( final Connection connection ) throws IOException { } private static class InitMessageHandler implements MessageHandler { private final ProcessController processController ; public InitMessageHandler ( final ProcessController processController ) { } public void handleMessage ( final Connection connection , final InputStream dataStream ) throws IOException { final int cmd = readUnsignedByte ( dataStream ) ; if ( cmd != ( Protocol . AUTH ) ) { ProcessLogger . SERVER_LOGGER . receivedUnknownGreetingCode ( Integer . valueOf ( cmd ) , connection . getPeerAddress ( ) ) ; connection . close ( ) ; return ; } final int version = StreamUtils . readUnsignedByte ( dataStream ) ; if ( version < 1 ) { ProcessLogger . SERVER_LOGGER . receivedInvalidVersion ( connection . getPeerAddress ( ) ) ; connection . close ( ) ; return ; } final byte [ ] authCode = new byte [ 16 ] ; StreamUtils . readFully ( dataStream , authCode ) ; final ManagedProcess process = processController . getServerByAuthCode ( authCode ) ; if ( process == null ) { ProcessLogger . SERVER_LOGGER . receivedUnknownCredentials ( connection . getPeerAddress ( ) ) ; StreamUtils . safeClose ( connection ) ; return ; } ProcessLogger . SERVER_LOGGER . tracef ( "Received<seq2seq4repair_space>authentic<seq2seq4repair_space>connection<seq2seq4repair_space>from<seq2seq4repair_space>%s" , connection . getPeerAddress ( ) ) ; connection . setMessageHandler ( new ProcessControllerServerHandler . InitMessageHandler . ConnectedMessageHandler ( processController , process . isPrivileged ( ) ) ) ; processController . addManagedConnection ( connection ) ; dataStream . close ( ) ; } public void handleShutdown ( final Connection connection ) throws IOException { } public void handleFailure ( final Connection connection , final IOException e ) throws IOException { } public void handleFinished ( final Connection connection ) throws IOException { } private static class ConnectedMessageHandler implements MessageHandler { private final boolean isPrivileged ; private final ProcessController processController ; public ConnectedMessageHandler ( final ProcessController processController , final boolean isHostController ) { } public void handleMessage ( final Connection connection , final InputStream dataStream ) throws IOException { ProcessMessageHandler . OperationType operationType = null ; String processName = null ; try { final int cmd = StreamUtils . readUnsignedByte ( dataStream ) ; switch ( cmd ) { case Protocol . SEND_STDIN : { if ( isPrivileged ) { operationType = OperationType . SEND_STDIN ; processName = readUTFZBytes ( dataStream ) ; ProcessLogger . SERVER_LOGGER . tracef ( "Received<seq2seq4repair_space>send_stdin<seq2seq4repair_space>for<seq2seq4repair_space>process<seq2seq4repair_space>%s" , processName ) ; processController . sendStdin ( processName , dataStream ) ; } else { ProcessLogger . SERVER_LOGGER . tracef ( "Ignoring<seq2seq4repair_space>send_stdin<seq2seq4repair_space>message<seq2seq4repair_space>from<seq2seq4repair_space>untrusted<seq2seq4repair_space>source" ) ; } dataStream . close ( ) ; break ; } case Protocol . ADD_PROCESS : { if ( isPrivileged ) { operationType = OperationType . ADD ; processName = readUTFZBytes ( dataStream ) ; final byte [ ] authKey = new byte [ 16 ] ; readFully ( dataStream , authKey ) ; final int commandCount = readInt ( dataStream ) ; final String [ ] command = new String [ commandCount ] ; for ( int i = 0 ; i < commandCount ; i ++ ) { command [ i ] = readUTFZBytes ( dataStream ) ; } final int envCount = readInt ( dataStream ) ; final Map < String , String > env = new HashMap < String , String > ( ) ; for ( int i = 0 ; i < envCount ; i ++ ) { env . put ( readUTFZBytes ( dataStream ) , readUTFZBytes ( dataStream ) ) ; } final String workingDirectory = readUTFZBytes ( dataStream ) ; ProcessLogger . SERVER_LOGGER . tracef ( "Received<seq2seq4repair_space>add_process<seq2seq4repair_space>for<seq2seq4repair_space>process<seq2seq4repair_space>%s" , processName ) ; <START_BUG> processController . addProcess ( processName , Arrays . asList ( command ) , env , workingDirectory , false , false ) ; <END_BUG> } else { ProcessLogger . SERVER_LOGGER . tracef ( "Ignoring<seq2seq4repair_space>add_process<seq2seq4repair_space>message<seq2seq4repair_space>from<seq2seq4repair_space>untrusted<seq2seq4repair_space>source" ) ; } dataStream . close ( ) ; break ; } case Protocol . START_PROCESS : { if ( isPrivileged ) { operationType = OperationType . START ; processName = readUTFZBytes ( dataStream ) ; processController . startProcess ( processName ) ; ProcessLogger . SERVER_LOGGER . tracef ( "Received<seq2seq4repair_space>start_process<seq2seq4repair_space>for<seq2seq4repair_space>process<seq2seq4repair_space>%s" , processName ) ; } else { ProcessLogger . SERVER_LOGGER . tracef ( "Ignoring<seq2seq4repair_space>start_process<seq2seq4repair_space>message<seq2seq4repair_space>from<seq2seq4repair_space>untrusted<seq2seq4repair_space>source" ) ; } dataStream . close ( ) ; break ; } case Protocol . STOP_PROCESS : { if ( isPrivileged ) { operationType = OperationType . STOP ; processName = readUTFZBytes ( dataStream ) ; processController . stopProcess ( processName ) ; } else { ProcessLogger . SERVER_LOGGER . tracef ( "Ignoring<seq2seq4repair_space>stop_process<seq2seq4repair_space>message<seq2seq4repair_space>from<seq2seq4repair_space>untrusted<seq2seq4repair_space>source" ) ; } dataStream . close ( ) ; break ; } case Protocol . REMOVE_PROCESS : { if ( isPrivileged ) { operationType = OperationType . REMOVE ; processName = readUTFZBytes ( dataStream ) ; processController . removeProcess ( processName ) ; } else { ProcessLogger . SERVER_LOGGER . tracef ( "Ignoring<seq2seq4repair_space>remove_process<seq2seq4repair_space>message<seq2seq4repair_space>from<seq2seq4repair_space>untrusted<seq2seq4repair_space>source" ) ; } dataStream . close ( ) ; break ; } case Protocol . REQUEST_PROCESS_INVENTORY : { if ( isPrivileged ) { operationType = OperationType . INVENTORY ; processController . sendInventory ( ) ; } else { ProcessLogger . SERVER_LOGGER . tracef ( "Ignoring<seq2seq4repair_space>request_process_inventory<seq2seq4repair_space>message<seq2seq4repair_space>from<seq2seq4repair_space>untrusted<seq2seq4repair_space>source" ) ; } dataStream . close ( ) ; break ; } case Protocol . RECONNECT_PROCESS : { if ( isPrivileged ) { operationType = OperationType . REMOVE ; processName = readUTFZBytes ( dataStream ) ; final String hostName = readUTFZBytes ( dataStream ) ; final int port = readInt ( dataStream ) ; final boolean managementSubsystemEndpoint = readBoolean ( dataStream ) ; final byte [ ] asAuthKey = new byte [ 16 ] ; readFully ( dataStream , asAuthKey ) ; processController . sendReconnectProcess ( processName , hostName , port , managementSubsystemEndpoint , asAuthKey ) ; } else { ProcessLogger . SERVER_LOGGER . tracef ( "Ignoring<seq2seq4repair_space>reconnect_process<seq2seq4repair_space>message<seq2seq4repair_space>from<seq2seq4repair_space>untrusted<seq2seq4repair_space>source" ) ; } dataStream . close ( ) ; break ; }

Fix:
processController . addProcess ( processName , authKey , Arrays . asList ( command ) , env , workingDirectory , false , false ) ;