Buggy code:
private final ScheduledExecutorService scheduledExecutor ; private final NewModelControllerClient controllerClient ; private final ServerDeploymentRepository deploymentRepository ; private final ContentRepository contentRepository ; private FileFilter filter = new ExtensibleFilter ( ) ; private volatile boolean autoDeployZip ; private volatile boolean autoDeployExploded ; private volatile long maxNoProgress = FileSystemDeploymentService . MAX_NO_PROGRESS ; private volatile long deploymentTimeout = FileSystemDeploymentService . DEFAULT_DEPLOYMENT_TIMEOUT ; private final String relativeTo ; private final String relativePath ; private final Runnable scanRunnable = new Runnable ( ) { @ Override public void run ( ) { } } ; FileSystemDeploymentService ( final String relativeTo , final File deploymentDir , final File relativeToDir , final NewModelControllerClient controllerClient , final ScheduledExecutorService scheduledExecutor , final ServerDeploymentRepository deploymentRepository , final ContentRepository contentRepository ) throws OperationFailedException { } @ Override public boolean isAutoDeployZippedContent ( ) { } @ Override public void setAutoDeployZippedContent ( boolean autoDeployZip ) { } @ Override public boolean isAutoDeployExplodedContent ( ) { } @ Override public void setAutoDeployExplodedContent ( boolean autoDeployExploded ) { } @ Override public boolean isEnabled ( ) { } @ Override public long getScanInterval ( ) { } @ Override public synchronized void setScanInterval ( long scanInterval ) { } @ Override public void setDeploymentTimeout ( long deploymentTimeout ) { } @ Override public synchronized void startScanner ( ) { } @ Override public synchronized void stopScanner ( ) { } void setMaxNoProgress ( long max ) { } private void establishDeployedContentList ( File dir ) throws OperationFailedException { } void scan ( ) { try { scanLock . lockInterruptibly ( ) ; } catch ( InterruptedException ie ) { Thread . currentThread ( ) . interrupt ( ) ; return ; } boolean scheduleRescan = false ; try { if ( scanEnabled ) { FileSystemDeploymentService . log . tracef ( "Scanning<seq2seq4repair_space>directory<seq2seq4repair_space>%s<seq2seq4repair_space>for<seq2seq4repair_space>deployment<seq2seq4repair_space>content<seq2seq4repair_space>changes" , deploymentDir . getAbsolutePath ( ) ) ; FileSystemDeploymentService . ScanContext scanContext = new FileSystemDeploymentService . ScanContext ( ) ; scanDirectory ( deploymentDir , scanContext ) ; ignoredMissingDeployments . retainAll ( scanContext . ignoredMissingDeployments ) ; for ( String deploymentName : scanContext . ignoredMissingDeployments ) { if ( ignoredMissingDeployments . add ( deploymentName ) ) { FileSystemDeploymentService . log . warnf ( "Deployment<seq2seq4repair_space>of<seq2seq4repair_space>'%s'<seq2seq4repair_space>requested,<seq2seq4repair_space>but<seq2seq4repair_space>the<seq2seq4repair_space>deployment<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>present" , deploymentName ) ; } } noticeLogged . retainAll ( scanContext . nonDeployable ) ; for ( String fileName : scanContext . nonDeployable ) { if ( noticeLogged . add ( fileName ) ) { FileSystemDeploymentService . log . infof ( "Found<seq2seq4repair_space>%s<seq2seq4repair_space>in<seq2seq4repair_space>deployment<seq2seq4repair_space>directory.<seq2seq4repair_space>To<seq2seq4repair_space>trigger<seq2seq4repair_space>deployment<seq2seq4repair_space>create<seq2seq4repair_space>a<seq2seq4repair_space>file<seq2seq4repair_space>called<seq2seq4repair_space>%s%s" , fileName , fileName , FileSystemDeploymentService . DO_DEPLOY ) ; } } FileSystemDeploymentService . ScanStatus status = handleAutoDeployFailures ( scanContext ) ; if ( status != ( FileSystemDeploymentService . ScanStatus . PROCEED ) ) { if ( ( status == ( FileSystemDeploymentService . ScanStatus . RETRY ) ) && ( ( scanInterval ) > 1000 ) ) { scheduleRescan = true ; } return ; } List < FileSystemDeploymentService . ScannerTask > scannerTasks = scanContext . scannerTasks ; for ( String missing : scanContext . toRemove ) { File parent = deploymentDir ; scannerTasks . add ( new FileSystemDeploymentService . UndeployTask ( missing , parent ) ) ; } if ( ( scannerTasks . size ( ) ) > 0 ) { List < ModelNode > updates = new ArrayList < ModelNode > ( scannerTasks . size ( ) ) ; for ( FileSystemDeploymentService . ScannerTask task : scannerTasks ) { task . recordInProgress ( ) ; final ModelNode update = task . getUpdate ( ) ; if ( FileSystemDeploymentService . log . isDebugEnabled ( ) ) { FileSystemDeploymentService . log . debugf ( "Deployment<seq2seq4repair_space>scan<seq2seq4repair_space>of<seq2seq4repair_space>[%s]<seq2seq4repair_space>found<seq2seq4repair_space>update<seq2seq4repair_space>action<seq2seq4repair_space>[%s]" , deploymentDir , update ) ; } updates . add ( update ) ; } while ( ! ( updates . isEmpty ( ) ) ) { ModelNode composite = getCompositeUpdate ( updates ) ; <START_BUG> final FileSystemDeploymentService . DeploymentTask deploymentTask = new FileSystemDeploymentService . DeploymentTask ( Factory . create ( composite ) . build ( ) ) ; <END_BUG> final Future < ModelNode > futureResults = scheduledExecutor . submit ( deploymentTask ) ; final ModelNode results ; try { results = futureResults . get ( deploymentTimeout , TimeUnit . SECONDS ) ; } catch ( TimeoutException e ) { futureResults . cancel ( true ) ; final ModelNode failure = new ModelNode ( ) ; failure . get ( OUTCOME ) . set ( FAILED ) ; failure . get ( FAILURE_DESCRIPTION ) . set ( ( ( ( ( "Did<seq2seq4repair_space>not<seq2seq4repair_space>receive<seq2seq4repair_space>a<seq2seq4repair_space>response<seq2seq4repair_space>to<seq2seq4repair_space>the<seq2seq4repair_space>deployment<seq2seq4repair_space>operation<seq2seq4repair_space>within<seq2seq4repair_space>" + "the<seq2seq4repair_space>allowed<seq2seq4repair_space>timeout<seq2seq4repair_space>period<seq2seq4repair_space>[" ) + ( deploymentTimeout ) ) + "<seq2seq4repair_space>seconds].<seq2seq4repair_space>Check<seq2seq4repair_space>the<seq2seq4repair_space>server<seq2seq4repair_space>configuration" ) + "file<seq2seq4repair_space>and<seq2seq4repair_space>the<seq2seq4repair_space>server<seq2seq4repair_space>logs<seq2seq4repair_space>to<seq2seq4repair_space>find<seq2seq4repair_space>more<seq2seq4repair_space>about<seq2seq4repair_space>the<seq2seq4repair_space>status<seq2seq4repair_space>of<seq2seq4repair_space>the<seq2seq4repair_space>deployment." ) ) ; for ( FileSystemDeploymentService . ScannerTask task : scannerTasks ) { task . handleFailureResult ( failure ) ; } break ; } catch ( Exception e ) { FileSystemDeploymentService . log . error ( "File<seq2seq4repair_space>system<seq2seq4repair_space>deployment<seq2seq4repair_space>service<seq2seq4repair_space>failed" , e ) ; futureResults . cancel ( true ) ; final ModelNode failure = new ModelNode ( ) ; failure . get ( OUTCOME ) . set ( FAILED ) ; failure . get ( FAILURE_DESCRIPTION ) . set ( e . getMessage ( ) ) ; for ( FileSystemDeploymentService . ScannerTask task : scannerTasks ) { task . handleFailureResult ( failure ) ; } break ; } final List < Property > resultList = results . get ( RESULT ) . asPropertyList ( ) ; final List < ModelNode > toRetry = new ArrayList < ModelNode > ( ) ; final List < FileSystemDeploymentService . ScannerTask > retryTasks = new ArrayList < FileSystemDeploymentService . ScannerTask > ( ) ; for ( int i = 0 ; i < ( resultList . size ( ) ) ; i ++ ) { final ModelNode result = resultList . get ( i ) . getValue ( ) ; final FileSystemDeploymentService . ScannerTask task = scannerTasks . get ( i ) ; final ModelNode outcome = result . get ( OUTCOME ) ; if ( ( outcome . isDefined ( ) ) && ( SUCCESS . equals ( outcome . asString ( ) ) ) ) { task . handleSuccessResult ( ) ; }

Fix:
final FileSystemDeploymentService . DeploymentTask deploymentTask = new FileSystemDeploymentService . DeploymentTask ( new org . jboss . as . controller . client . NewOperationBuilder ( composite ) . build ( ) ) ;