Program: 106025
Project: 106025
Buggy source:
@Override public KVMPhysicalDisk getPhysicalDisk(String volumeUuid,KVMStoragePool pool){
  LibvirtStoragePool libvirtPool=(LibvirtStoragePool)pool;
  try {
    StorageVol vol=this.getVolume(libvirtPool.getPool(),volumeUuid);
    KVMPhysicalDisk disk;
    LibvirtStorageVolumeDef voldef=getStorageVolumeDef(libvirtPool.getPool().getConnect(),vol);
    disk=new KVMPhysicalDisk(vol.getPath(),vol.getName(),pool);
    disk.setSize(vol.getInfo().allocation);
    disk.setVirtualSize(vol.getInfo().capacity);
    if (pool.getType() == StoragePoolType.RBD) {
      disk.setFormat(PhysicalDiskFormat.RAW);
    }
 else     if (voldef.getFormat() == null) {
      File diskDir=new File(disk.getPath());
      if (diskDir.exists() && diskDir.isDirectory()) {
        disk.setFormat(PhysicalDiskFormat.DIR);
      }
 else       if (volumeUuid.endsWith("String_Node_Str") || volumeUuid.endsWith(("String_Node_Str"))) {
        disk.setFormat(PhysicalDiskFormat.TAR);
      }
 else       if (volumeUuid.endsWith("String_Node_Str") || volumeUuid.endsWith(("String_Node_Str"))) {
        disk.setFormat(PhysicalDiskFormat.RAW);
      }
 else {
        disk.setFormat(pool.getDefaultFormat());
      }
    }
 else     if (voldef.getFormat() == LibvirtStorageVolumeDef.volFormat.QCOW2) {
      disk.setFormat(PhysicalDiskFormat.QCOW2);
    }
 else     if (voldef.getFormat() == LibvirtStorageVolumeDef.volFormat.RAW) {
      disk.setFormat(PhysicalDiskFormat.RAW);
    }
    return disk;
  }
 catch (  LibvirtException e) {
    s_logger.debug("String_Node_Str",e);
    throw new CloudRuntimeException(e.toString());
  }
}

Fixed version (ground truth):
@Override public KVMPhysicalDisk getPhysicalDisk(String volumeUuid,KVMStoragePool pool){
  LibvirtStoragePool libvirtPool=(LibvirtStoragePool)pool;
  try {
    StorageVol vol=getVolume(libvirtPool.getPool(),volumeUuid);
    KVMPhysicalDisk disk;
    LibvirtStorageVolumeDef voldef=getStorageVolumeDef(libvirtPool.getPool().getConnect(),vol);
    disk=new KVMPhysicalDisk(vol.getPath(),vol.getName(),pool);
    disk.setSize(vol.getInfo().allocation);
    disk.setVirtualSize(vol.getInfo().capacity);
    if (pool.getType() == StoragePoolType.RBD) {
      disk.setFormat(PhysicalDiskFormat.RAW);
    }
 else     if (voldef.getFormat() == null) {
      File diskDir=new File(disk.getPath());
      if (diskDir.exists() && diskDir.isDirectory()) {
        disk.setFormat(PhysicalDiskFormat.DIR);
      }
 else       if (volumeUuid.endsWith("String_Node_Str") || volumeUuid.endsWith(("String_Node_Str"))) {
        disk.setFormat(PhysicalDiskFormat.TAR);
      }
 else       if (volumeUuid.endsWith("String_Node_Str") || volumeUuid.endsWith(("String_Node_Str"))) {
        disk.setFormat(PhysicalDiskFormat.RAW);
      }
 else {
        disk.setFormat(pool.getDefaultFormat());
      }
    }
 else     if (voldef.getFormat() == LibvirtStorageVolumeDef.volFormat.QCOW2) {
      disk.setFormat(PhysicalDiskFormat.QCOW2);
    }
 else     if (voldef.getFormat() == LibvirtStorageVolumeDef.volFormat.RAW) {
      disk.setFormat(PhysicalDiskFormat.RAW);
    }
    return disk;
  }
 catch (  LibvirtException e) {
    s_logger.debug("String_Node_Str",e);
    throw new CloudRuntimeException(e.toString());
  }
}