Buggy code:
public class DeploymentHandlerUtil { static class ContentItem { private byte [ ] hash ; private String path ; private String relativeTo ; private boolean isArchive ; ContentItem ( final byte [ ] hash ) { } ContentItem ( final String path , final String relativeTo , final boolean isArchive ) { } byte [ ] getHash ( ) { } } private DeploymentHandlerUtil ( ) { } public static void deploy ( final OperationContext context , final String deploymentUnitName , final String managementName , final AbstractVaultReader vaultReader , final DeploymentHandlerUtil . ContentItem ... contents ) throws OperationFailedException { } public static Collection < ServiceController < ? > > doDeploy ( final OperationContext context , final String deploymentUnitName , final String managementName , final ServiceVerificationHandler verificationHandler , final Resource deploymentResource , final ImmutableManagementResourceRegistration registration , final ManagementResourceRegistration mutableRegistration , final AbstractVaultReader vaultReader , final DeploymentHandlerUtil . ContentItem ... contents ) { final ServiceName deploymentUnitServiceName = Services . deploymentUnitName ( deploymentUnitName ) ; final List < ServiceController < ? > > controllers = new ArrayList < ServiceController < ? > > ( ) ; final ServiceTarget serviceTarget = context . getServiceTarget ( ) ; final ServiceController < ? > contentService ; final ServiceName contentsServiceName = deploymentUnitServiceName . append ( "contents" ) ; if ( ( contents [ 0 ] . hash ) != null ) contentService = ContentServitor . addService ( serviceTarget , contentsServiceName , contents [ 0 ] . hash , verificationHandler ) ; else { final String path = contents [ 0 ] . path ; final String relativeTo = contents [ 0 ] . relativeTo ; contentService = PathContentServitor . addService ( serviceTarget , contentsServiceName , path , relativeTo , verificationHandler ) ; } controllers . add ( contentService ) ; final RootDeploymentUnitService service = new RootDeploymentUnitService ( deploymentUnitName , managementName , null , registration , mutableRegistration , deploymentResource , verificationHandler , vaultReader ) ; <START_BUG> final ServiceController < DeploymentUnit > deploymentUnitController = serviceTarget . addService ( deploymentUnitServiceName , service ) . addDependency ( JBOSS_DEPLOYMENT_CHAINS , DeployerChains . class , service . getDeployerChainsInjector ( ) ) . addDependency ( SERVICE_NAME , DeploymentMountProvider . class , service . getServerDeploymentRepositoryInjector ( ) ) . addDependency ( contentsServiceName , VirtualFile . class , service . contentsInjector ) . addListener ( ALL , verificationHandler ) . setInitialMode ( ACTIVE ) . install ( ) ; <END_BUG> controllers . add ( deploymentUnitController ) ; contentService . addListener ( new org . jboss . msc . service . AbstractServiceListener < Object > ( ) { @ Override public void transition ( final ServiceController < ? > controller , final ServiceController . Transition transition ) { if ( transition == ( Transition . REMOVING_to_REMOVED ) ) { deploymentUnitController . setMode ( REMOVE ) ; } } } ) ; return controllers ; } public static void redeploy ( final OperationContext context , final String deploymentUnitName , final String managementName , final AbstractVaultReader vaultReader , final DeploymentHandlerUtil . ContentItem ... contents ) throws OperationFailedException { } public static void replace ( final OperationContext context , final ModelNode originalDeployment , final String deploymentUnitName , final String managementName , final String replacedDeploymentUnitName , final AbstractVaultReader vaultReader , final DeploymentHandlerUtil . ContentItem ... contents ) throws OperationFailedException { } public static void undeploy ( final OperationContext context , final String managementName , final String deploymentUnitName , final AbstractVaultReader vaultReader ) { } private static String getFormattedFailureDescription ( OperationContext context ) { } }

Fix:
final ServiceController < DeploymentUnit > deploymentUnitController = serviceTarget . addService ( deploymentUnitServiceName , service ) . addDependency ( JBOSS_DEPLOYMENT_CHAINS , DeployerChains . class , service . getDeployerChainsInjector ( ) ) . addDependency ( SERVICE_NAME , DeploymentMountProvider . class , service . getServerDeploymentRepositoryInjector ( ) ) . addDependency ( contentsServiceName , VirtualFile . class , service . contentsInjector ) . addListener ( verificationHandler ) . setInitialMode ( ACTIVE ) . install ( ) ;