Buggy code:
public class DeploymentFullReplaceHandler implements ModelUpdateOperationHandler , DescriptionProvider { public static final String OPERATION_NAME = FULL_REPLACE_DEPLOYMENT ; static final ModelNode getOperation ( ModelNode address ) { } private static final List < String > VALID_DEPLOYMENT_PARAMETERS = Arrays . asList ( INPUT_STREAM_INDEX , BYTES , HASH , URL ) ; private final ContentRepository contentRepository ; private final ParametersValidator validator = new ParametersValidator ( ) ; public DeploymentFullReplaceHandler ( final ContentRepository contentRepository ) { } @ Override public ModelNode getModelDescription ( Locale locale ) { } @ Override public OperationResult execute ( OperationContext context , ModelNode operation , ResultHandler resultHandler ) throws OperationFailedException { validator . validate ( operation ) ; String name = operation . require ( NAME ) . asString ( ) ; String runtimeName = ( operation . hasDefined ( RUNTIME_NAME ) ) ? operation . get ( RUNTIME_NAME ) . asString ( ) : name ; byte [ ] hash ; if ( tooManyDeploymentParametersDefined ( operation ) ) { throw createFailureException ( "Only<seq2seq4repair_space>allowed<seq2seq4repair_space>one<seq2seq4repair_space>of<seq2seq4repair_space>the<seq2seq4repair_space>following<seq2seq4repair_space>parameters<seq2seq4repair_space>is<seq2seq4repair_space>allowed<seq2seq4repair_space>%s." , DeploymentFullReplaceHandler . VALID_DEPLOYMENT_PARAMETERS ) ; } else if ( operation . hasDefined ( HASH ) ) { hash = operation . get ( HASH ) . asBytes ( ) ; if ( ! ( contentRepository . hasContent ( hash ) ) ) { throw createFailureException ( "No<seq2seq4repair_space>deployment<seq2seq4repair_space>content<seq2seq4repair_space>with<seq2seq4repair_space>hash<seq2seq4repair_space>%s<seq2seq4repair_space>is<seq2seq4repair_space>available<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>deployment<seq2seq4repair_space>content<seq2seq4repair_space>repository." , HashUtil . bytesToHexString ( hash ) ) ; } } else if ( hasValidDeploymentParameterDefined ( operation ) ) { InputStream in = getContents ( context , operation ) ; try { try { hash = contentRepository . addContent ( in ) ; } catch ( IOException e ) { throw createFailureException ( e . toString ( ) ) ; } } finally { StreamUtils . safeClose ( in ) ; } } else { throw createFailureException ( "None<seq2seq4repair_space>of<seq2seq4repair_space>the<seq2seq4repair_space>following<seq2seq4repair_space>parameters<seq2seq4repair_space>were<seq2seq4repair_space>defined<seq2seq4repair_space>%s." , DeploymentFullReplaceHandler . VALID_DEPLOYMENT_PARAMETERS ) ; } ModelNode rootModel = context . getSubModel ( ) ; ModelNode deployments = rootModel . get ( DEPLOYMENT ) ; ModelNode replaceNode = ( deployments . hasDefined ( name ) ) ? deployments . get ( name ) : null ; if ( replaceNode == null ) { throw createFailureException ( "No<seq2seq4repair_space>deployment<seq2seq4repair_space>with<seq2seq4repair_space>name<seq2seq4repair_space>%s<seq2seq4repair_space>found" , name ) ; } boolean start = replaceNode . get ( ENABLED ) . asBoolean ( ) ; ModelNode deployNode = new ModelNode ( ) ; deployNode . get ( NAME ) . set ( name ) ; deployNode . get ( RUNTIME_NAME ) . set ( runtimeName ) ; deployNode . get ( HASH ) . set ( hash ) ; deployNode . get ( ENABLED ) . set ( start ) ; deployments . get ( name ) . set ( deployNode ) ; ModelNode compensatingOp = operation . clone ( ) ; compensatingOp . get ( RUNTIME_NAME ) . set ( replaceNode . get ( RUNTIME_NAME ) . asString ( ) ) ; compensatingOp . get ( HASH ) . set ( replaceNode . get ( HASH ) . asBytes ( ) ) ; if ( operation . hasDefined ( INPUT_STREAM_INDEX ) ) { operation . remove ( INPUT_STREAM_INDEX ) ; } if ( start ) { <START_BUG> DeploymentHandlerUtil . replace ( deployNode , name , context , resultHandler ) ; <END_BUG> } else { resultHandler . handleResultComplete ( ) ; } return new org . jboss . as . controller . BasicOperationResult ( compensatingOp ) ; } private InputStream getContents ( OperationContext context , ModelNode operation ) throws OperationFailedException { } private boolean hasValidDeploymentParameterDefined ( ModelNode operation ) { } private boolean tooManyDeploymentParametersDefined ( ModelNode operation ) { } private OperationFailedException createFailureException ( String format , Object ... params ) { } private OperationFailedException createFailureException ( Throwable cause , String format , Object ... params ) { } private OperationFailedException createFailureException ( String msg ) { } private OperationFailedException createFailureException ( Throwable cause , String msg ) { } }

Fix:
DeploymentHandlerUtil . replace ( context , name , runtimeName , hash , resultHandler ) ;