Source:
<code>public boolean deleteSnapshot(Long snapshotId) { SnapshotVO snapshotVO = snapshotDao.findById(snapshotId); if (snapshotVO.getState() == Snapshot.State.Allocated) { snapshotDao.remove(snapshotId); return true; } if (snapshotVO.getState() == Snapshot.State.Destroyed) { return true; } if (Snapshot.State.Error.equals(snapshotVO.getState())) { List<SnapshotDataStoreVO> storeRefs = snapshotStoreDao.findBySnapshotId(snapshotId); for (SnapshotDataStoreVO ref : storeRefs) { snapshotStoreDao.expunge(ref.getId()); } snapshotDao.remove(snapshotId); return true; } if (snapshotVO.getState() == Snapshot.State.CreatedOnPrimary) { snapshotVO.setState(Snapshot.State.Destroyed); snapshotDao.update(snapshotId, snapshotVO); return true; } if (!Snapshot.State.BackedUp.equals(snapshotVO.getState()) && !Snapshot.State.Destroying.equals(snapshotVO.getState())) { throw new InvalidParameterValueException("Can't delete snapshotshot " + snapshotId + " due to it is in " + snapshotVO.getState() + " Status"); } Boolean deletedOnSecondary = deleteOnSecondaryIfNeeded(snapshotId); boolean deletedOnPrimary = deleteOnPrimaryIfNeeded(snapshotId); if (deletedOnPrimary) { s_logger.debug(String.format("Successfully deleted snapshot (id: %d) on primary storage.", snapshotId)); } else { s_logger.debug(String.format("The snapshot (id: %d) could not be found/deleted on primary storage.", snapshotId)); } <START> if (null == deletedOnSecondary && deletedOnSecondary) { <END> s_logger.debug(String.format("Successfully deleted snapshot (id: %d) on secondary storage.", snapshotId)); } return (deletedOnSecondary != null) && deletedOnSecondary || deletedOnPrimary; }</code><technical_language>I guess instead of null == deletedOnSecondary && deletedOnSecondary null == deletedOnPrimary && deletedOnSecondary, right? deletedOnSecondary != null && deletedOnSecondary</technical_language>

Target:
public boolean deleteSnapshot(Long snapshotId) { SnapshotVO snapshotVO = snapshotDao.findById(snapshotId); if (snapshotVO.getState() == Snapshot.State.Allocated) { snapshotDao.remove(snapshotId); return true; } if (snapshotVO.getState() == Snapshot.State.Destroyed) { return true; } if (Snapshot.State.Error.equals(snapshotVO.getState())) { List<SnapshotDataStoreVO> storeRefs = snapshotStoreDao.findBySnapshotId(snapshotId); for (SnapshotDataStoreVO ref : storeRefs) { snapshotStoreDao.expunge(ref.getId()); } snapshotDao.remove(snapshotId); return true; } if (snapshotVO.getState() == Snapshot.State.CreatedOnPrimary) { snapshotVO.setState(Snapshot.State.Destroyed); snapshotDao.update(snapshotId, snapshotVO); return true; } if (!Snapshot.State.BackedUp.equals(snapshotVO.getState()) && !Snapshot.State.Destroying.equals(snapshotVO.getState())) { throw new InvalidParameterValueException("Can't delete snapshotshot " + snapshotId + " due to it is in " + snapshotVO.getState() + " Status"); } Boolean deletedOnSecondary = deleteOnSecondaryIfNeeded(snapshotId); boolean deletedOnPrimary = deleteOnPrimaryIfNeeded(snapshotId); if (deletedOnPrimary) { s_logger.debug(String.format("Successfully deleted snapshot (id: %d) on primary storage.", snapshotId)); } else { s_logger.debug(String.format("The snapshot (id: %d) could not be found/deleted on primary storage.", snapshotId)); } if (null != deletedOnSecondary && deletedOnSecondary) { s_logger.debug(String.format("Successfully deleted snapshot (id: %d) on secondary storage.", snapshotId)); } return (deletedOnSecondary != null) && deletedOnSecondary || deletedOnPrimary; }