Program: 105345
Project: 105345
Buggy source:
@Override public Answer copyVolumeFromImageCacheToPrimary(CopyCommand cmd){
  VolumeObjectTO srcVolume=(VolumeObjectTO)cmd.getSrcTO();
  VolumeObjectTO destVolume=(VolumeObjectTO)cmd.getDestTO();
  VmwareContext context=hostService.getServiceContext(cmd);
  try {
    NfsTO srcStore=(NfsTO)srcVolume.getDataStore();
    DataStoreTO destStore=destVolume.getDataStore();
    VmwareHypervisorHost hyperHost=hostService.getHyperHost(context,cmd);
    String uuid=destStore.getUuid();
    ManagedObjectReference morDatastore=HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost,uuid);
    if (morDatastore == null) {
      URI uri=new URI(destStore.getUrl());
      morDatastore=hyperHost.mountDatastore(false,uri.getHost(),0,uri.getPath(),destStore.getUuid().replace("String_Node_Str","String_Node_Str"));
      if (morDatastore == null) {
        throw new Exception("String_Node_Str" + uri.getHost() + "String_Node_Str"+ uri.getPath());
      }
    }
    Pair<String,String> result=copyVolumeFromSecStorage(hyperHost,srcVolume.getPath(),new DatastoreMO(context,morDatastore),srcStore.getUrl(),cmd.getWait() * 1000);
    deleteVolumeDirOnSecondaryStorage(result.first(),srcStore.getUrl());
    VolumeObjectTO newVolume=new VolumeObjectTO();
    newVolume.setPath(result.second());
    return new CopyCmdAnswer(newVolume);
  }
 catch (  Throwable t) {
    if (t instanceof RemoteException) {
      hostService.invalidateServiceContext(context);
    }
    String msg="String_Node_Str";
    s_logger.error(msg,t);
    return new CopyCmdAnswer("String_Node_Str" + VmwareHelper.getExceptionMessage(t));
  }
}

Fixed version (ground truth):
@Override public Answer copyVolumeFromImageCacheToPrimary(CopyCommand cmd){
  VolumeObjectTO srcVolume=(VolumeObjectTO)cmd.getSrcTO();
  VolumeObjectTO destVolume=(VolumeObjectTO)cmd.getDestTO();
  VmwareContext context=hostService.getServiceContext(cmd);
  try {
    NfsTO srcStore=(NfsTO)srcVolume.getDataStore();
    DataStoreTO destStore=destVolume.getDataStore();
    VmwareHypervisorHost hyperHost=hostService.getHyperHost(context,cmd);
    String uuid=destStore.getUuid();
    ManagedObjectReference morDatastore=HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost,uuid);
    if (morDatastore == null) {
      URI uri=new URI(destStore.getUrl());
      morDatastore=hyperHost.mountDatastore(false,uri.getHost(),0,uri.getPath(),destStore.getUuid().replace("String_Node_Str","String_Node_Str"));
      if (morDatastore == null) {
        throw new Exception("String_Node_Str" + uri.getHost() + "String_Node_Str"+ uri.getPath());
      }
    }
    Pair<String,String> result=copyVolumeFromSecStorage(hyperHost,srcVolume.getPath(),new DatastoreMO(context,morDatastore),srcStore.getUrl(),(long)cmd.getWait() * 1000);
    deleteVolumeDirOnSecondaryStorage(result.first(),srcStore.getUrl());
    VolumeObjectTO newVolume=new VolumeObjectTO();
    newVolume.setPath(result.second());
    return new CopyCmdAnswer(newVolume);
  }
 catch (  Throwable t) {
    if (t instanceof RemoteException) {
      hostService.invalidateServiceContext(context);
    }
    String msg="String_Node_Str";
    s_logger.error(msg,t);
    return new CopyCmdAnswer("String_Node_Str" + VmwareHelper.getExceptionMessage(t));
  }
}