Program: 105488
Project: 105488
Buggy source:
@Override public Answer createVolumeFromSnapshot(CopyCommand cmd){
  DataTO srcData=cmd.getSrcTO();
  SnapshotObjectTO snapshot=(SnapshotObjectTO)srcData;
  DataTO destData=cmd.getDestTO();
  DataStoreTO pool=destData.getDataStore();
  DataStoreTO imageStore=srcData.getDataStore();
  if (!(imageStore instanceof NfsTO)) {
    return new CopyCmdAnswer("String_Node_Str");
  }
  NfsTO nfsImageStore=(NfsTO)imageStore;
  String primaryStorageNameLabel=pool.getUuid();
  String secondaryStorageUrl=nfsImageStore.getUrl();
  String backedUpSnapshotUuid=snapshot.getPath();
  int index=backedUpSnapshotUuid.lastIndexOf(File.separator);
  String backupPath=backedUpSnapshotUuid.substring(0,index);
  backedUpSnapshotUuid=backedUpSnapshotUuid.substring(index + 1);
  String details=null;
  String newVolumeName=VmwareHelper.getVCenterSafeUuid();
  VmwareContext context=hostService.getServiceContext(cmd);
  try {
    VmwareHypervisorHost hyperHost=hostService.getHyperHost(context,cmd);
    ManagedObjectReference morPrimaryDs=HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost,primaryStorageNameLabel);
    if (morPrimaryDs == null) {
      String msg="String_Node_Str" + primaryStorageNameLabel;
      s_logger.error(msg);
      throw new Exception(msg);
    }
    if (backedUpSnapshotUuid.endsWith("String_Node_Str")) {
      backedUpSnapshotUuid=backedUpSnapshotUuid.replace("String_Node_Str","String_Node_Str");
    }
 else     if (backedUpSnapshotUuid.endsWith("String_Node_Str")) {
      backedUpSnapshotUuid=backedUpSnapshotUuid.replace("String_Node_Str","String_Node_Str");
    }
    DatastoreMO primaryDsMo=new DatastoreMO(hyperHost.getContext(),morPrimaryDs);
    restoreVolumeFromSecStorage(hyperHost,primaryDsMo,newVolumeName,secondaryStorageUrl,backupPath,backedUpSnapshotUuid,cmd.getWait() * 1000);
    VolumeObjectTO newVol=new VolumeObjectTO();
    newVol.setPath(newVolumeName);
    return new CopyCmdAnswer(newVol);
  }
 catch (  Throwable e) {
    if (e instanceof RemoteException) {
      hostService.invalidateServiceContext(context);
    }
    s_logger.error("String_Node_Str",e);
    details="String_Node_Str" + VmwareHelper.getExceptionMessage(e);
  }
  return new CopyCmdAnswer(details);
}

Fixed version (ground truth):
@Override public Answer createVolumeFromSnapshot(CopyCommand cmd){
  DataTO srcData=cmd.getSrcTO();
  SnapshotObjectTO snapshot=(SnapshotObjectTO)srcData;
  DataTO destData=cmd.getDestTO();
  DataStoreTO pool=destData.getDataStore();
  DataStoreTO imageStore=srcData.getDataStore();
  if (!(imageStore instanceof NfsTO)) {
    return new CopyCmdAnswer("String_Node_Str");
  }
  NfsTO nfsImageStore=(NfsTO)imageStore;
  String primaryStorageNameLabel=pool.getUuid();
  String secondaryStorageUrl=nfsImageStore.getUrl();
  String backedUpSnapshotUuid=snapshot.getPath();
  int index=backedUpSnapshotUuid.lastIndexOf(File.separator);
  String backupPath=backedUpSnapshotUuid.substring(0,index);
  backedUpSnapshotUuid=backedUpSnapshotUuid.substring(index + 1);
  String details=null;
  String newVolumeName=VmwareHelper.getVCenterSafeUuid();
  VmwareContext context=hostService.getServiceContext(cmd);
  try {
    VmwareHypervisorHost hyperHost=hostService.getHyperHost(context,cmd);
    ManagedObjectReference morPrimaryDs=HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost,primaryStorageNameLabel);
    if (morPrimaryDs == null) {
      String msg="String_Node_Str" + primaryStorageNameLabel;
      s_logger.error(msg);
      throw new Exception(msg);
    }
    if (backedUpSnapshotUuid.endsWith("String_Node_Str")) {
      backedUpSnapshotUuid=backedUpSnapshotUuid.replace("String_Node_Str","String_Node_Str");
    }
 else     if (backedUpSnapshotUuid.endsWith("String_Node_Str")) {
      backedUpSnapshotUuid=backedUpSnapshotUuid.replace("String_Node_Str","String_Node_Str");
    }
    DatastoreMO primaryDsMo=new DatastoreMO(hyperHost.getContext(),morPrimaryDs);
    restoreVolumeFromSecStorage(hyperHost,primaryDsMo,newVolumeName,secondaryStorageUrl,backupPath,backedUpSnapshotUuid,(long)cmd.getWait() * 1000);
    VolumeObjectTO newVol=new VolumeObjectTO();
    newVol.setPath(newVolumeName);
    return new CopyCmdAnswer(newVol);
  }
 catch (  Throwable e) {
    if (e instanceof RemoteException) {
      hostService.invalidateServiceContext(context);
    }
    s_logger.error("String_Node_Str",e);
    details="String_Node_Str" + VmwareHelper.getExceptionMessage(e);
  }
  return new CopyCmdAnswer(details);
}