[Demonstration 1]

[Buggy Method]
private void processContainers(final AutoScaledGroupOptions options, final Container... containers) throws Exception {
    // Collect all applicable containers
    for (Container container : containers) {
        Container rootContainer = container.isRoot() ? container : container.getParent();
        if (matchesRootContainerPattern(rootContainer.getId())) {
            if (!hasChild(rootContainer.getId())) {
                addChild(new AutoScaledHost(rootContainer.getIp(), rootContainer));
            }
            if (options.isScaleContainers() && matchesContainerPattern(container.getId()) || !options.isScaleContainers() && matchesContainerPattern(container.getId()) && container.isAlive()) {
                AutoScaledContainer.createAutoScaledContainer(this, container, containerFactory);
            }
        }
    }
    if (!options.isScaleContainers() && getGrandChildren().size() < options.getMinContainerCount()) {
        throw new Exception("Not enough containers available (" + getGrandChildren().size() + "), " + options.getMinContainerCount() + " required");
    }
}

[Buggy Hunk]
if (!hasChild(rootContainer.getId())) {

[Patch]
if (!hasChild(rootContainer.getIp())) {

[Demonstration 2]

[Buggy Method]
private void deleteInternal(LockedInodePath inodePath, boolean recursive, boolean replayed, long opTimeMs) throws FileDoesNotExistException, IOException, DirectoryNotEmptyException, InvalidPathException {
    // TODO(jiri): A crash after any UFS object is deleted and before the delete operation is
    // journaled will result in an inconsistency between Alluxio and UFS.
    if (!inodePath.fullPathExists()) {
        return;
    }
    Inode<?> inode = inodePath.getInode();
    if (inode == null) {
        return;
    }
    if (inode.isDirectory() && !recursive && ((InodeDirectory) inode).getNumberOfChildren() > 0) {
        // inode is nonempty, and we don't want to delete a nonempty directory unless recursive is
        // true
        throw new DirectoryNotEmptyException(ExceptionMessage.DELETE_NONEMPTY_DIRECTORY_NONRECURSIVE, inode.getName());
    }
    if (mInodeTree.isRootId(inode.getId())) {
        // The root cannot be deleted.
        throw new InvalidPathException(ExceptionMessage.DELETE_ROOT_DIRECTORY.getMessage());
    }
    List<Inode<?>> delInodes = new ArrayList<>();
    delInodes.add(inode);
    try (InodeLockList lockList = mInodeTree.lockDescendants(inodePath, InodeTree.LockMode.WRITE)) {
        delInodes.addAll(lockList.getInodes());
        TempInodePathForDescendant tempInodePath = new TempInodePathForDescendant(inodePath);
        // We go through each inode, removing it from its parent set and from mDelInodes. If it's a
        // file, we deal with the checkpoints and blocks as well.
        for (int i = delInodes.size() - 1; i >= 0; i--) {
            Inode<?> delInode = delInodes.get(i);
            // the path to delInode for getPath should already be locked.
            AlluxioURI alluxioUriToDel = mInodeTree.getPath(delInode);
            tempInodePath.setDescendant(delInode, alluxioUriToDel);
            // TODO(jiri): What should the Alluxio behavior be when a UFS delete operation fails?
            // Currently, it will result in an inconsistency between Alluxio and UFS.
            if (!replayed && delInode.isPersisted()) {
                try {
                    // If this is a mount point, we have deleted all the children and can unmount it
                    // TODO(calvin): Add tests (ALLUXIO-1831)
                    if (mMountTable.isMountPoint(alluxioUriToDel)) {
                        //comment(Jason): in our case, mount table should not be delete always
                        unmountInternal(alluxioUriToDel);
                    } else {
                        // Delete the file in the under file system.
                        MountTable.Resolution resolution = mMountTable.resolve(alluxioUriToDel);
                        String ufsUri = resolution.getUri().toString();
                        UnderFileSystem ufs = resolution.getUfs();
                        boolean failedToDelete = false;
                        if (delInode.isFile()) {
                            if (!ufs.deleteFile(ufsUri)) {
                                failedToDelete = ufs.isFile(ufsUri);
                                if (!failedToDelete) {
                                    LOG.warn("The file to delete does not exist in ufs: {}", ufsUri);
                                }
                            }
                        } else {
                            if (!ufs.deleteDirectory(ufsUri, DeleteOptions.defaults().setRecursive(true))) {
                                failedToDelete = ufs.isDirectory(ufsUri);
                                if (!failedToDelete) {
                                    LOG.warn("The directory to delete does not exist in ufs: {}", ufsUri);
                                }
                            }
                        }
                        if (failedToDelete) {
                            LOG.error("Failed to delete {} from the under filesystem", ufsUri);
                            throw new IOException(ExceptionMessage.DELETE_FAILED_UFS.getMessage(ufsUri));
                        }
                    }
                } catch (InvalidPathException e) {
                    LOG.warn(e.getMessage());
                }
            }
            if (delInode.isFile()) {
                // Remove corresponding blocks from workers and delete metadata in master.
                mBlockMaster.removeBlocks(((InodeFile) delInode).getBlockIds(), true);
            }
            mInodeTree.deleteInode(tempInodePath, opTimeMs);
        }
    }
    Metrics.PATHS_DELETED.inc(delInodes.size());
}

[Buggy Hunk]
if (!replayed && delInode.isPersisted()) {

[Patch]
if (!replayed && delInode.isPersisted() && LOAD_METADATA_FROM_UFS_ENABLED) {

[Demonstration 3]

[Buggy Method]
public Result create() {
    UUID id = UUID.randomUUID();
    return ok(edit.render(id));
}

[Buggy Hunk]
UUID id = UUID.randomUUID();

[Patch]
UUID id = null;