Program: 167784
Project: 167784
Buggy source:
/** 
 * Executes an operation on the controller latching onto an existing transaction
 * @param operation the operation
 * @param handler the handler
 * @param control the transaction control
 * @param attachments the operation attachments
 * @param prepareStep the prepare step to be executed before any other steps
 * @param operationId the id of the current transaction
 * @return the result of the operation
 */
protected ModelNode executeReadOnlyOperation(final ModelNode operation,final OperationMessageHandler handler,final OperationTransactionControl control,final OperationAttachments attachments,final OperationStepHandler prepareStep,final int operationId){
  final SecurityManager sm=System.getSecurityManager();
  if (sm != null) {
    sm.checkPermission(ModelController.ACCESS_PERMISSION);
  }
  final OperationContext delegateContext=activeOperations.get(operationId);
  if (delegateContext == null) {
    throw MESSAGES.noContextToDelegateTo(operationId);
    ;
  }
  final ModelNode response=new ModelNode();
  final OperationTransactionControl originalResultTxControl=control == null ? null : new OperationTransactionControl(){
    @Override public void operationPrepared(    OperationTransaction transaction,    ModelNode result){
      control.operationPrepared(transaction,response);
    }
  }
;
  final ReadOnlyContext context=new ReadOnlyContext(processType,runningModeControl.getRunningMode(),originalResultTxControl,processState,false,delegateContext,this,operationId);
  context.addStep(response,operation,prepareStep,OperationContext.Stage.MODEL);
  CurrentOperationIdHolder.setCurrentOperationID(operationId);
  try {
    context.executeOperation();
  }
  finally {
    CurrentOperationIdHolder.setCurrentOperationID(null);
  }
  if (!response.hasDefined(RESPONSE_HEADERS) || !response.get(RESPONSE_HEADERS).hasDefined(PROCESS_STATE)) {
    ControlledProcessState.State state=processState.getState();
switch (state) {
case RELOAD_REQUIRED:
case RESTART_REQUIRED:
      response.get(RESPONSE_HEADERS,PROCESS_STATE).set(state.toString());
    break;
default :
  break;
}
}
return response;
}

Fixed version (ground truth):
/** 
 * Executes an operation on the controller latching onto an existing transaction
 * @param operation the operation
 * @param handler the handler
 * @param control the transaction control
 * @param attachments the operation attachments
 * @param prepareStep the prepare step to be executed before any other steps
 * @param operationId the id of the current transaction
 * @return the result of the operation
 */
protected ModelNode executeReadOnlyOperation(final ModelNode operation,final OperationMessageHandler handler,final OperationTransactionControl control,final OperationAttachments attachments,final OperationStepHandler prepareStep,final int operationId){
  final SecurityManager sm=System.getSecurityManager();
  if (sm != null) {
    sm.checkPermission(ModelController.ACCESS_PERMISSION);
  }
  final OperationContext delegateContext=activeOperations.get(operationId);
  if (delegateContext == null) {
    throw MESSAGES.noContextToDelegateTo(operationId);
  }
  final ModelNode response=new ModelNode();
  final OperationTransactionControl originalResultTxControl=control == null ? null : new OperationTransactionControl(){
    @Override public void operationPrepared(    OperationTransaction transaction,    ModelNode result){
      control.operationPrepared(transaction,response);
    }
  }
;
  final ReadOnlyContext context=new ReadOnlyContext(processType,runningModeControl.getRunningMode(),originalResultTxControl,processState,false,delegateContext,this,operationId);
  context.addStep(response,operation,prepareStep,OperationContext.Stage.MODEL);
  CurrentOperationIdHolder.setCurrentOperationID(operationId);
  try {
    context.executeOperation();
  }
  finally {
    CurrentOperationIdHolder.setCurrentOperationID(null);
  }
  if (!response.hasDefined(RESPONSE_HEADERS) || !response.get(RESPONSE_HEADERS).hasDefined(PROCESS_STATE)) {
    ControlledProcessState.State state=processState.getState();
switch (state) {
case RELOAD_REQUIRED:
case RESTART_REQUIRED:
      response.get(RESPONSE_HEADERS,PROCESS_STATE).set(state.toString());
    break;
default :
  break;
}
}
return response;
}