[Demonstration 1]

[Buggy Method]
protected void deleteFromTarget(Map<String, String> parameters, PublishingTarget target, PublishedChangeSet changeSet) {
    String deletedList = parameters.get(PARAM_DELETED_FILES);
    String site = parameters.get(PARAM_SITE);
    if (deletedList != null) {
        StringTokenizer tokens = new StringTokenizer(deletedList, FILES_SEPARATOR);
        List<String> deletedFiles = new ArrayList<String>(tokens.countTokens());
        while (tokens.hasMoreElements()) {
            String contentLocation = tokens.nextToken();
            contentLocation = StringUtils.trimWhitespace(contentLocation);
            String root = target.getParameter(CONFIG_ROOT);
            String fullPath = root + '/' + target.getParameter(CONFIG_CONTENT_FOLDER) + contentLocation;
            if (LOGGER.isInfoEnabled()) {
                LOGGER.info("deleting " + fullPath);
            }
            if (StringUtils.hasText(site)) {
                fullPath = fullPath.replaceAll(CONFIG_MULTI_TENANCY_VARIABLE, site);
            }
            File file = new File(fullPath);
            if (file.exists()) {
                if (file.isFile()) {
                    file.delete();
                    deletedFiles.add(contentLocation);
                } else {
                    deleteChildren(file.list(), fullPath, contentLocation, deletedFiles);
                    file.delete();
                }
            } else {
                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug(fullPath + " is not deleted since it does not exsit.");
                }
            }
            fullPath = root + '/' + target.getParameter(CONFIG_METADATA_FOLDER) + contentLocation + CONFIG_METADATA_FILENAME_SUFFIX;
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("deleting " + fullPath);
            }
            if (StringUtils.hasText(site)) {
                fullPath = fullPath.replaceAll(CONFIG_MULTI_TENANCY_VARIABLE, site);
            }
            file = new File(fullPath);
            if (file.exists()) {
                file.delete();
            } else if (LOGGER.isDebugEnabled()) {
                LOGGER.debug(fullPath + " is not deleted since it does not exsit.");
            }
        }
        changeSet.setDeletedFiles(deletedFiles);
    }
}

[Buggy Hunk]
String fullPath = root + '/' + target.getParameter(CONFIG_CONTENT_FOLDER) + contentLocation;

[Patch]
String fullPath = root + File.separator + target.getParameter(CONFIG_CONTENT_FOLDER) + contentLocation;

[Demonstration 2]

[Buggy Method]
private Object[] internalGetChildren(ISynchronizationContext context, Object parent, Object[] children) {
    List result = new ArrayList(children.length);
    for (int i = 0; i < children.length; i++) {
        Object object = children[i];
        // If the parent is a TreePath then the subclass is
        // TreePath aware and we can send a TrePath to the
        // isVisible method
        if (parent instanceof TreePath) {
            TreePath tp = (TreePath) parent;
            object = tp.createChildPath(object);
        }
        if (isVisible(context, object))
            result.add(internalGetElement(object));
    }
    return result.toArray(new Object[result.size()]);
}

[Buggy Hunk]
List result = new ArrayList(children.length);

[Patch]
List<Object> result = new ArrayList<>(children.length);

[Demonstration 3]

[Buggy Method]
public IParseRootNode getAST() {
    try {
        IDocument document = getDocument();
        return ParserPoolFactory.parse(getContentType(), document.get());
    } catch (Exception e) {
        IdeLog.logError(CommonEditorPlugin.getDefault(), e);
    }
    return null;
}

[Buggy Hunk]
IdeLog.logError(CommonEditorPlugin.getDefault(), e);

[Patch]
IdeLog.logTrace(CommonEditorPlugin.getDefault(), e.getMessage(), e, IDebugScopes.CONTENT_ASSIST);