Buggy code:
public final class ProcessControllerClient implements Closeable { private final Connection connection ; ProcessControllerClient ( final Connection connection ) { } public static ProcessControllerClient connect ( final ProtocolClient . Configuration configuration , final byte [ ] authCode , final ProcessMessageHandler messageHandler ) throws IOException { if ( configuration == null ) { throw ProcessMessages . MESSAGES . nullVar ( "configuration" ) ; } if ( authCode == null ) { throw ProcessMessages . MESSAGES . nullVar ( "authCode" ) ; } if ( messageHandler == null ) { throw ProcessMessages . MESSAGES . nullVar ( "messageHandler" ) ; } configuration . setMessageHandler ( new MessageHandler ( ) { public void handleMessage ( final Connection connection , final InputStream dataStream ) throws IOException { final ProcessControllerClient client = ( ( ProcessControllerClient ) ( connection . getAttachment ( ) ) ) ; final int cmd = readUnsignedByte ( dataStream ) ; switch ( cmd ) { case Protocol . PROCESS_ADDED : { final String processName = readUTFZBytes ( dataStream ) ; dataStream . close ( ) ; ProcessLogger . CLIENT_LOGGER . tracef ( "Received<seq2seq4repair_space>process_added<seq2seq4repair_space>for<seq2seq4repair_space>process<seq2seq4repair_space>%s" , processName ) ; messageHandler . handleProcessAdded ( client , processName ) ; break ; } case Protocol . PROCESS_STARTED : { final String processName = readUTFZBytes ( dataStream ) ; dataStream . close ( ) ; ProcessLogger . CLIENT_LOGGER . tracef ( "Received<seq2seq4repair_space>process_started<seq2seq4repair_space>for<seq2seq4repair_space>process<seq2seq4repair_space>%s" , processName ) ; messageHandler . handleProcessStarted ( client , processName ) ; break ; } case Protocol . PROCESS_STOPPED : { final String processName = readUTFZBytes ( dataStream ) ; final long uptimeMillis = readLong ( dataStream ) ; dataStream . close ( ) ; ProcessLogger . CLIENT_LOGGER . tracef ( "Received<seq2seq4repair_space>process_stopped<seq2seq4repair_space>for<seq2seq4repair_space>process<seq2seq4repair_space>%s" , processName ) ; messageHandler . handleProcessStopped ( client , processName , uptimeMillis ) ; break ; } case Protocol . PROCESS_REMOVED : { final String processName = readUTFZBytes ( dataStream ) ; dataStream . close ( ) ; ProcessLogger . CLIENT_LOGGER . tracef ( "Received<seq2seq4repair_space>process_removed<seq2seq4repair_space>for<seq2seq4repair_space>process<seq2seq4repair_space>%s" , processName ) ; messageHandler . handleProcessRemoved ( client , processName ) ; break ; } case Protocol . PROCESS_INVENTORY : { final int cnt = readInt ( dataStream ) ; final Map < String , ProcessInfo > inventory = new HashMap < String , ProcessInfo > ( ) ; for ( int i = 0 ; i < cnt ; i ++ ) { final String processName = readUTFZBytes ( dataStream ) ; final byte [ ] processAuthCode = new byte [ 16 ] ; readFully ( dataStream , processAuthCode ) ; final boolean processRunning = StreamUtils . readBoolean ( dataStream ) ; final boolean processStopping = StreamUtils . readBoolean ( dataStream ) ; <START_BUG> inventory . put ( processName , new ProcessInfo ( processName , authCode , processRunning , processStopping ) ) ; <END_BUG> } dataStream . close ( ) ; ProcessLogger . CLIENT_LOGGER . tracef ( "Received<seq2seq4repair_space>process_inventory" ) ; messageHandler . handleProcessInventory ( client , inventory ) ; break ; } case Protocol . OPERATION_FAILED : { final int operationType = readUnsignedByte ( dataStream ) ; final ProcessMessageHandler . OperationType type = OperationType . fromCode ( operationType ) ; final String processName = readUTFZBytes ( dataStream ) ; dataStream . close ( ) ; ProcessLogger . CLIENT_LOGGER . tracef ( "Received<seq2seq4repair_space>operation_failed<seq2seq4repair_space>for<seq2seq4repair_space>process<seq2seq4repair_space>%s" , processName ) ; messageHandler . handleOperationFailed ( client , type , processName ) ; break ; } default : { ProcessLogger . CLIENT_LOGGER . receivedUnknownMessageCode ( Integer . valueOf ( cmd ) ) ; dataStream . close ( ) ; break ; } } } public void handleShutdown ( final Connection connection ) throws IOException { final ProcessControllerClient client = ( ( ProcessControllerClient ) ( connection . getAttachment ( ) ) ) ; messageHandler . handleConnectionShutdown ( client ) ; } public void handleFailure ( final Connection connection , final IOException cause ) throws IOException { final ProcessControllerClient client = ( ( ProcessControllerClient ) ( connection . getAttachment ( ) ) ) ; messageHandler . handleConnectionFailure ( client , cause ) ; } public void handleFinished ( final Connection connection ) throws IOException { final ProcessControllerClient client = ( ( ProcessControllerClient ) ( connection . getAttachment ( ) ) ) ; messageHandler . handleConnectionFinished ( client ) ; } } ) ; final ProtocolClient client = new ProtocolClient ( configuration ) ; final Connection connection = client . connect ( ) ; boolean ok = false ; try { final OutputStream os = connection . writeMessage ( ) ; try { os . write ( AUTH ) ; os . write ( 1 ) ; os . write ( authCode ) ; final ProcessControllerClient processControllerClient = new ProcessControllerClient ( connection ) ; connection . attach ( processControllerClient ) ; ProcessLogger . CLIENT_LOGGER . trace ( "Sent<seq2seq4repair_space>initial<seq2seq4repair_space>greeting<seq2seq4repair_space>message" ) ; os . close ( ) ; ok = true ; return processControllerClient ; } finally { safeClose ( os ) ; } } finally { if ( ! ok ) { safeClose ( connection ) ; } } } public OutputStream sendStdin ( String processName ) throws IOException { } public void addProcess ( String processName , byte [ ] authKey , String [ ] cmd , String workingDir , Map < String , String > env ) throws IOException { } public void startProcess ( String processName ) throws IOException { } public void stopProcess ( String processName ) throws IOException { } public void removeProcess ( String processName ) throws IOException { } public void requestProcessInventory ( ) throws IOException { } public void reconnectProcess ( final String processName , final String hostName , final int port , final boolean managementSubsystemEndpoint , final byte [ ] authKey ) throws IOException { } public void shutdown ( ) throws IOException { } public void shutdown ( int exitCode ) throws IOException { } public void close ( ) throws IOException { } }

Fix:
inventory . put ( processName , new ProcessInfo ( processName , processAuthCode , processRunning , processStopping ) ) ;