Buggy code:
public class DeploymentUtils implements Closeable { public static final long DEFAULT_TIMEOUT = 15000 ; private final List < DeploymentUtils . AbstractDeployment > deployments = new ArrayList < DeploymentUtils . AbstractDeployment > ( ) ; private final ModelControllerClient client ; private final ServerDeploymentManager manager ; private long timeout = DeploymentUtils . DEFAULT_TIMEOUT ; public DeploymentUtils ( ) throws UnknownHostException { } public DeploymentUtils ( String archiveName , Package ... pkg ) throws UnknownHostException { } public DeploymentUtils ( Archive < ? > archive ) throws UnknownHostException { } public DeploymentUtils ( String archiveName , boolean show , Package ... pkgs ) throws UnknownHostException { } public synchronized void addDeployment ( String archiveName , Package ... pkgs ) { } public synchronized void addDeployment ( String archiveName , boolean show , Package ... pkgs ) { } public synchronized void addWarDeployment ( String archiveName , Package ... pkgs ) { } public synchronized void addWarDeployment ( String archiveName , boolean show , Package ... pkgs ) { } public synchronized void deploy ( ) throws IOException , InterruptedException , ExecutionException , TimeoutException , DuplicateDeploymentNameException { <START_BUG> DeploymentPlanBuilder builder = manager . newDeploymentPlan ( ) . withRollback ( ) ; <END_BUG> for ( DeploymentUtils . AbstractDeployment deployment : deployments ) { builder = deployment . addDeployment ( manager , builder ) ; } try { manager . execute ( builder . build ( ) ) . get ( timeout , TimeUnit . MILLISECONDS ) ; } finally { markDeploymentsDeployed ( ) ; } } private void markDeploymentsDeployed ( ) { } public synchronized void undeploy ( ) throws InterruptedException , ExecutionException , TimeoutException { } public MBeanServerConnection getConnection ( ) throws Exception { } public String showJndi ( ) throws Exception { } public long getTimeout ( ) { } public void setTimeout ( long timeout ) { } @ Override public void close ( ) throws IOException { } private abstract class AbstractDeployment { boolean deployed ; String deployment ; public synchronized DeploymentPlanBuilder addDeployment ( ServerDeploymentManager manager , DeploymentPlanBuilder builder ) throws IOException , InterruptedException , ExecutionException , DuplicateDeploymentNameException { } public synchronized DeploymentPlanBuilder removeDeployment ( DeploymentPlanBuilder builder ) { } protected void addFiles ( ResourceContainer < ? > archive , File dir , ArchivePath dest ) { } protected File getSourceMetaInfDir ( String archiveName ) { } protected File getSourceWebInfDir ( String archiveName ) { } protected File getOutputDir ( ) { } protected File createArchive ( Archive < ? > archive ) { } protected abstract File getRealArchive ( ) { } } private class Deployment extends DeploymentUtils . AbstractDeployment { final File realArchive ; public Deployment ( String archiveName , Package [ ] pkgs , boolean show ) { } @ Override protected File getRealArchive ( ) { } } private class WarDeployment extends DeploymentUtils . AbstractDeployment { final File realArchive ; public WarDeployment ( String archiveName , Package [ ] pkgs , boolean show ) { } @ Override protected File getRealArchive ( ) { } } private class ArbitraryDeployment extends DeploymentUtils . AbstractDeployment { final File realArchive ; public ArbitraryDeployment ( Archive archive , boolean show ) { } @ Override protected File getRealArchive ( ) { } } }

Fix:
DeploymentPlanBuilder builder = manager . newDeploymentPlan ( ) ;