Program: 106226
Project: 106226
Buggy source:
@DB protected void createBaseImageAsync(VolumeInfo volume,PrimaryDataStore dataStore,TemplateInfo template,AsyncCallFuture<VolumeApiResult> future){
  DataObject templateOnPrimaryStoreObj=dataStore.create(template);
  CreateBaseImageContext<CreateCmdResult> context=new CreateBaseImageContext<CreateCmdResult>(null,volume,dataStore,template,future,templateOnPrimaryStoreObj);
  AsyncCallbackDispatcher<VolumeServiceImpl,CopyCommandResult> caller=AsyncCallbackDispatcher.create(this);
  caller.setCallback(caller.getTarget().copyBaseImageCallback(null,null)).setContext(context);
  try {
    templateOnPrimaryStoreObj.processEvent(Event.CreateOnlyRequested);
  }
 catch (  Exception e) {
    try {
      templateOnPrimaryStoreObj=waitForTemplateDownloaded(dataStore,template);
    }
 catch (    Exception e1) {
      s_logger.debug("String_Node_Str" + template.getId() + "String_Node_Str");
      VolumeApiResult result=new VolumeApiResult(volume);
      result.setResult(e1.toString());
      future.complete(result);
      return;
    }
    if (templateOnPrimaryStoreObj == null) {
      VolumeApiResult result=new VolumeApiResult(volume);
      result.setResult("String_Node_Str" + template.getId() + "String_Node_Str");
      future.complete(result);
      return;
    }
 else {
      s_logger.debug("String_Node_Str" + template.getId() + "String_Node_Str");
      createVolumeFromBaseImageAsync(volume,templateOnPrimaryStoreObj,dataStore,future);
      return;
    }
  }
  try {
    motionSrv.copyAsync(template,templateOnPrimaryStoreObj,caller);
  }
 catch (  Exception e) {
    s_logger.debug("String_Node_Str",e);
    templateOnPrimaryStoreObj.processEvent(Event.OperationFailed);
    VolumeApiResult result=new VolumeApiResult(volume);
    result.setResult(e.toString());
    future.complete(result);
  }
  return;
}

Fixed version (ground truth):
@DB protected void createBaseImageAsync(VolumeInfo volume,PrimaryDataStore dataStore,TemplateInfo template,AsyncCallFuture<VolumeApiResult> future){
  DataObject templateOnPrimaryStoreObj=dataStore.create(template);
  CreateBaseImageContext<CreateCmdResult> context=new CreateBaseImageContext<CreateCmdResult>(null,volume,dataStore,template,future,templateOnPrimaryStoreObj);
  AsyncCallbackDispatcher<VolumeServiceImpl,CopyCommandResult> caller=AsyncCallbackDispatcher.create(this);
  caller.setCallback(caller.getTarget().copyBaseImageCallback(null,null)).setContext(context);
  try {
    templateOnPrimaryStoreObj.processEvent(Event.CreateOnlyRequested);
  }
 catch (  Exception e) {
    s_logger.info("String_Node_Str");
    try {
      templateOnPrimaryStoreObj=waitForTemplateDownloaded(dataStore,template);
    }
 catch (    Exception e1) {
      s_logger.debug("String_Node_Str" + template.getId() + "String_Node_Str");
      VolumeApiResult result=new VolumeApiResult(volume);
      result.setResult(e1.toString());
      future.complete(result);
      return;
    }
    if (templateOnPrimaryStoreObj == null) {
      VolumeApiResult result=new VolumeApiResult(volume);
      result.setResult("String_Node_Str" + template.getId() + "String_Node_Str");
      future.complete(result);
      return;
    }
 else {
      s_logger.debug("String_Node_Str" + template.getId() + "String_Node_Str");
      createVolumeFromBaseImageAsync(volume,templateOnPrimaryStoreObj,dataStore,future);
      return;
    }
  }
  try {
    motionSrv.copyAsync(template,templateOnPrimaryStoreObj,caller);
  }
 catch (  Exception e) {
    s_logger.debug("String_Node_Str",e);
    templateOnPrimaryStoreObj.processEvent(Event.OperationFailed);
    VolumeApiResult result=new VolumeApiResult(volume);
    result.setResult(e.toString());
    future.complete(result);
  }
  return;
}