Buggy code:
public class UndeployHandler extends DeploymentHandler { private final ArgumentWithoutValue l ; private final ArgumentWithoutValue path ; private final ArgumentWithValue name ; private final ArgumentWithValue serverGroups ; private final ArgumentWithoutValue allRelevantServerGroups ; private final ArgumentWithoutValue keepContent ; private final ArgumentWithValue script ; public UndeployHandler ( CommandContext ctx ) { } @ Override protected void doHandle ( CommandContext ctx ) throws CommandLineException { } @ Override public ModelNode buildRequestWithoutHeaders ( CommandContext ctx ) throws CommandFormatException { final ModelNode composite = new ModelNode ( ) ; composite . get ( OPERATION ) . set ( COMPOSITE ) ; composite . get ( ADDRESS ) . setEmptyList ( ) ; final ModelNode steps = composite . get ( STEPS ) ; final ParsedCommandLine args = ctx . getParsedCommandLine ( ) ; final String name = this . name . getValue ( args ) ; final boolean keepContent = this . keepContent . isPresent ( args ) ; final boolean allRelevantServerGroups = this . allRelevantServerGroups . isPresent ( args ) ; final String serverGroupsStr = this . serverGroups . getValue ( args ) ; final String path = this . path . getValue ( args ) ; final File f ; if ( path != null ) { f = new File ( path ) ; if ( ! ( f . exists ( ) ) ) { throw new OperationFormatException ( ( ( "Path<seq2seq4repair_space>'" + ( f . getAbsolutePath ( ) ) ) + "'<seq2seq4repair_space>doesn't<seq2seq4repair_space>exist." ) ) ; } if ( ! ( isCliArchive ( f ) ) ) { throw new OperationFormatException ( ( ( "File<seq2seq4repair_space>'" + ( f . getAbsolutePath ( ) ) ) + "'<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>a<seq2seq4repair_space>valid<seq2seq4repair_space>CLI<seq2seq4repair_space>archive.<seq2seq4repair_space>CLI<seq2seq4repair_space>archives<seq2seq4repair_space>should<seq2seq4repair_space>have<seq2seq4repair_space>a<seq2seq4repair_space>'.cli'<seq2seq4repair_space>extension." ) ) ; } } else { f = null ; } if ( isCliArchive ( f ) ) { if ( name != null ) { throw new OperationFormatException ( ( ( this . name . getFullName ( ) ) + "<seq2seq4repair_space>can't<seq2seq4repair_space>be<seq2seq4repair_space>used<seq2seq4repair_space>in<seq2seq4repair_space>combination<seq2seq4repair_space>with<seq2seq4repair_space>a<seq2seq4repair_space>CLI<seq2seq4repair_space>archive." ) ) ; } if ( ( serverGroupsStr != null ) || allRelevantServerGroups ) { throw new OperationFormatException ( ( ( ( ( this . serverGroups . getFullName ( ) ) + "<seq2seq4repair_space>and<seq2seq4repair_space>" ) + ( this . allRelevantServerGroups . getFullName ( ) ) ) + "<seq2seq4repair_space>can't<seq2seq4repair_space>be<seq2seq4repair_space>used<seq2seq4repair_space>in<seq2seq4repair_space>combination<seq2seq4repair_space>with<seq2seq4repair_space>a<seq2seq4repair_space>CLI<seq2seq4repair_space>archive." ) ) ; } if ( keepContent ) { throw new OperationFormatException ( ( ( this . keepContent . getFullName ( ) ) + "<seq2seq4repair_space>can't<seq2seq4repair_space>be<seq2seq4repair_space>used<seq2seq4repair_space>in<seq2seq4repair_space>combination<seq2seq4repair_space>with<seq2seq4repair_space>a<seq2seq4repair_space>CLI<seq2seq4repair_space>archive." ) ) ; } TempFileProvider tempFileProvider ; MountHandle root ; try { <START_BUG> tempFileProvider = TempFileProvider . create ( "cli" , Executors . newSingleThreadScheduledExecutor ( ) ) ; <END_BUG> root = extractArchive ( f , tempFileProvider ) ; } catch ( IOException e ) { throw new OperationFormatException ( ( ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>extract<seq2seq4repair_space>archive<seq2seq4repair_space>'" + ( f . getAbsolutePath ( ) ) ) + "'<seq2seq4repair_space>to<seq2seq4repair_space>temporary<seq2seq4repair_space>location" ) ) ; } final File currentDir = ctx . getCurrentDir ( ) ; ctx . setCurrentDir ( root . getMountSource ( ) ) ; String holdbackBatch = activateNewBatch ( ctx ) ; try { String script = this . script . getValue ( args ) ; if ( script == null ) { script = "undeploy.scr" ; } File scriptFile = new File ( ctx . getCurrentDir ( ) , script ) ; if ( ! ( scriptFile . exists ( ) ) ) { throw new CommandFormatException ( ( ( ( ( "ERROR:<seq2seq4repair_space>script<seq2seq4repair_space>'" + script ) + "'<seq2seq4repair_space>not<seq2seq4repair_space>found<seq2seq4repair_space>in<seq2seq4repair_space>archive<seq2seq4repair_space>'" ) + ( f . getAbsolutePath ( ) ) ) + "'." ) ) ; } BufferedReader reader = null ; try { reader = new BufferedReader ( new FileReader ( scriptFile ) ) ; String line = reader . readLine ( ) ; while ( ( ! ( ctx . isTerminated ( ) ) ) && ( line != null ) ) { ctx . handle ( line ) ; line = reader . readLine ( ) ; } } catch ( FileNotFoundException e ) { throw new CommandFormatException ( ( ( ( ( "ERROR:<seq2seq4repair_space>script<seq2seq4repair_space>'" + script ) + "'<seq2seq4repair_space>not<seq2seq4repair_space>found<seq2seq4repair_space>in<seq2seq4repair_space>archive<seq2seq4repair_space>'" ) + ( f . getAbsolutePath ( ) ) ) + "'." ) ) ; } catch ( IOException e ) { throw new CommandFormatException ( ( ( ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>read<seq2seq4repair_space>the<seq2seq4repair_space>next<seq2seq4repair_space>command<seq2seq4repair_space>from<seq2seq4repair_space>" + ( scriptFile . getName ( ) ) ) + ":<seq2seq4repair_space>" ) + ( e . getMessage ( ) ) ) , e ) ; } catch ( CommandLineException e ) { throw new CommandFormatException ( e . getMessage ( ) , e ) ; } finally { if ( reader != null ) { try { reader . close ( ) ; } catch ( IOException e ) { } } } return ctx . getBatchManager ( ) . getActiveBatch ( ) . toRequest ( ) ; } finally { ctx . setCurrentDir ( currentDir ) ; discardBatch ( ctx , holdbackBatch ) ; VFSUtils . safeClose ( root , tempFileProvider ) ; } } if ( name == null ) { throw new OperationFormatException ( "Deployment<seq2seq4repair_space>name<seq2seq4repair_space>is<seq2seq4repair_space>missing." ) ; } final ModelControllerClient client = ctx . getModelControllerClient ( ) ; DefaultOperationRequestBuilder builder ; final List < String > deploymentNames ; if ( ( name . indexOf ( '*' ) ) < 0 ) { deploymentNames = Collections . singletonList ( name ) ; } else { deploymentNames = Util . getMatchingDeployments ( client , name , null ) ; if ( deploymentNames . isEmpty ( ) ) { throw new CommandFormatException ( ( "No<seq2seq4repair_space>deployment<seq2seq4repair_space>matched<seq2seq4repair_space>wildcard<seq2seq4repair_space>expression<seq2seq4repair_space>" + name ) ) ; } } for ( String deploymentName : deploymentNames ) { final List < String > serverGroups ; if ( ctx . isDomainMode ( ) ) { if ( allRelevantServerGroups ) { if ( keepContent ) { serverGroups = Util . getAllEnabledServerGroups ( deploymentName , client ) ; } else { try { serverGroups = Util . getServerGroupsReferencingDeployment ( deploymentName , client ) ; } catch ( CommandLineException e ) { throw new CommandFormatException ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>retrieve<seq2seq4repair_space>all<seq2seq4repair_space>referencing<seq2seq4repair_space>server<seq2seq4repair_space>groups" , e ) ; } } } else { if ( serverGroupsStr == null ) { serverGroups = Collections . emptyList ( ) ; }

Fix:
tempFileProvider = TempFileProvider . create ( "cli" , Executors . newSingleThreadScheduledExecutor ( ) , true ) ;