Buggy code:
@ SuppressWarnings ( "deprecation" ) abstract class AbstractOperationContext implements OperationContext { private static final Set < String > NON_COPIED_HEADERS = Collections . unmodifiableSet ( new HashSet < String > ( Arrays . asList ( ALLOW_RESOURCE_SERVICE_RESTART , ROLLBACK_ON_RUNTIME_FAILURE , ROLLOUT_PLAN ) ) ) ; static final ThreadLocal < Thread > controllingThread = new ThreadLocal < Thread > ( ) ; final Thread initiatingThread ; private final EnumMap < Stage , Deque < AbstractOperationContext . Step > > steps ; private final OperationTransactionControl transactionControl ; private final ControlledProcessState processState ; private final boolean booting ; private final ProcessType processType ; private final RunningMode runningMode ; private final Environment callEnvironment ; boolean respectInterruption = true ; Stage currentStage = Stage . MODEL ; ResultAction resultAction ; boolean cancelled ; AbstractOperationContext . Step activeStep ; Caller caller ; private boolean executing ; private final List < ModelNode > controllerOperations = new ArrayList < ModelNode > ( 2 ) ; private boolean auditLogged ; private final AuditLogger auditLogger ; enum ContextFlag { ROLLBACK_ON_FAIL , ALLOW_RESOURCE_SERVICE_RESTART ; } AbstractOperationContext ( final ProcessType processType , final RunningMode runningMode , final ModelController . OperationTransactionControl transactionControl , final ControlledProcessState processState , final boolean booting , final AuditLogger auditLogger ) { } @ Override public boolean isBooting ( ) { } @ Override public void addStep ( final OperationStepHandler step , final Stage stage ) throws IllegalArgumentException { } @ Override public void addStep ( final ModelNode operation , final OperationStepHandler step , final Stage stage ) throws IllegalArgumentException { } @ Override public void addStep ( final ModelNode operation , final OperationStepHandler step , final Stage stage , final boolean addFirst ) throws IllegalArgumentException { } @ Override public void addStep ( final ModelNode response , final ModelNode operation , final OperationStepHandler step , final Stage stage ) throws IllegalArgumentException { } @ Override public void addStep ( OperationStepHandler step , Stage stage , boolean addFirst ) throws IllegalArgumentException { } void addStep ( final ModelNode response , final ModelNode operation , final PathAddress address , final OperationStepHandler step , final Stage stage ) throws IllegalArgumentException { } @ Override public void addStep ( ModelNode response , ModelNode operation , OperationStepHandler step , Stage stage , boolean addFirst ) throws IllegalArgumentException { } void addStep ( final ModelNode response , final ModelNode operation , final PathAddress address , final OperationStepHandler step , final Stage stage , boolean addFirst ) throws IllegalArgumentException { } @ Override public final ModelNode getFailureDescription ( ) { } @ Override public final boolean hasFailureDescription ( ) { } @ Override public final ModelNode getResponseHeaders ( ) { } ResultAction executeOperation ( ) { } private ResultAction completeStepInternal ( ) { } @ Override public final void completeStep ( RollbackHandler rollbackHandler ) { } @ Override public final void completeStep ( ResultHandler resultHandler ) { } @ Override public final void stepCompleted ( ) { } abstract void awaitModelControllerContainerMonitor ( ) throws InterruptedException { } abstract PersistenceResource createPersistenceResource ( ) throws ConfigurationPersistenceException { } abstract void releaseStepLocks ( AbstractOperationContext . Step step ) { } abstract void waitForRemovals ( ) throws InterruptedException { } abstract boolean isReadOnly ( ) { } boolean isControllingThread ( ) { } void logAuditRecord ( ) { } private InetAddress getSubjectInetAddress ( Subject subject ) { } private < T extends Principal > T getPrincipal ( Subject subject , Class < T > clazz ) { } private void recordControllerOperation ( ModelNode operation ) { <START_BUG> controllerOperations . add ( operation ) ; <END_BUG> } abstract Resource getModel ( ) { } private void doCompleteStep ( ) { } private boolean canContinueProcessing ( ) { } @ SuppressWarnings ( "ConstantConditions" ) private void executeStep ( final AbstractOperationContext . Step step ) { } private boolean isErrorLoggingNecessary ( ) { } private void finishStep ( AbstractOperationContext . Step step ) { } private static void throwThrowable ( Throwable toThrow ) { } private ResultAction getFailedResultAction ( Throwable cause ) { } public final ProcessType getProcessType ( ) { } public final RunningMode getRunningMode ( ) { } @ Override public final boolean isNormalServer ( ) { } @ Override public final boolean isRollbackOnly ( ) { } @ Override public final void setRollbackOnly ( ) { } final boolean isRollingBack ( ) { } @ Override public final void reloadRequired ( ) { } @ Override public final void restartRequired ( ) { } @ Override public final void revertReloadRequired ( ) { } @ Override public final void revertRestartRequired ( ) { } @ Override public final void runtimeUpdateSkipped ( ) { } @ Override public final ModelNode getResult ( ) { } @ Override public final boolean hasResult ( ) { } @ Override public final ModelNode getServerResults ( ) { } private boolean hasMoreSteps ( ) { } @ Override public Caller getCaller ( ) { } @ Override public Environment getCallEnvironment ( ) { } class Step { private final OperationStepHandler handler ; final ModelNode response ; final ModelNode operation ; final PathAddress address ; final AbstractOperationContext . OperationId operationId ; private Object restartStamp ; private ResultHandler resultHandler ; AbstractOperationContext . Step predecessor ; private Step ( final OperationStepHandler handler , final ModelNode response , final ModelNode operation , final PathAddress address ) { } private void finalizeStep ( Throwable toThrow ) { } private void finalizeInternal ( ) { } private void handleRollback ( ) { } } private static class RollbackDelegatingResultHandler implements ResultHandler { private final RollbackHandler delegate ; private RollbackDelegatingResultHandler ( RollbackHandler delegate ) { } @ Override public void handleResult ( ResultAction resultAction , OperationContext context , ModelNode operation ) { } } static class OperationId { final PathAddress address ; final String name ; OperationId ( ModelNode operation ) { } private OperationId ( PathAddress address , String name ) { } @ Override public boolean equals ( Object o ) { } @ Override public int hashCode ( ) { } } }

Fix:
controllerOperations . add ( operation . clone ( ) ) ;