[Demonstration 1]

[Buggy Method]
private final void internalRun(FileParser parser) {
    // Check for rejected files.
    // The parser is in a error state as long as there are files there.
    if (!isLocked())
        return;
    // Check if there are any files to import,
    // ignoring any unimportant files such as '.DS_Store'.
    if (getInputFiles().length == 0)
        return;
    isRunning = true;
    // If there are files to import wait a while and make sure the
    // files are stable.
    if (inputDirSignature != getDirSignature()) {
        logger.info("Files discovered in the input directory. Making sure the files have been completly transfered before parsing will begin.");
        startStabilizationPeriod();
        return;
    }
    // Wait until the input files seem to be stable.
    if (stabilizationPeriodEnd.isAfterNow())
        return;
    stabilizationPeriodEnd = null;
    inputDirSignature = -1;
    // Once stable check to see if all the expected files are there.
    File[] input = getInputFiles();
    if (!parser.validateInputStructure(input)) {
        logger.error("Not all expected files could be found. Moving the input to the rejected folder.");
        moveAllFilesToRejected();
        return;
    }
    // If so parse and import them.
    runParser(parser);
}

[Buggy Hunk]
if (!isLocked()) return;

[Patch]
if (isLocked()) return;

[Demonstration 2]

[Buggy Method]
public static ColumnWrapper[] restoreColumns(IMemento memento) {
    if (memento == null) {
        return ColumnWrapper.fromSaveArray(Preferences.getColumns());
    }
    ColumnInfo[] infos = ColumnInfo.values();
    ColumnWrapper[] wrappers = new ColumnWrapper[infos.length];
    for (ColumnInfo ci : ColumnInfo.values()) {
        IMemento m = memento.getChild(ci.name());
        if (m == null) {
            for (int i = 0; i < wrappers.length; i++) {
                if (wrappers[i] == null) {
                    wrappers[i] = new ColumnWrapper(ci, false);
                    break;
                }
            }
        } else {
            Boolean visible = m.getBoolean(M_VISIBLE);
            Integer order = m.getInteger(M_ORDER_KEY);
            ColumnWrapper w = null;
            if (wrappers[order] == null) {
                wrappers[order] = new ColumnWrapper(ci, visible);
                w = wrappers[order];
            } else {
                for (int i = 0; i < wrappers.length; i++) {
                    if (wrappers[i] == null) {
                        wrappers[i] = new ColumnWrapper(ci, visible);
                        w = wrappers[i];
                        break;
                    }
                }
            }
            Integer minWidth = m.getInteger(M_MIN_WIDTH);
            Integer weight = m.getInteger(M_WEIGHT);
            if (w != null) {
                w.name = m.getString(M_NAME);
                w.minWidth = minWidth == null ? Integer.valueOf(-1) : minWidth;
                w.weight = weight == null ? Integer.valueOf(-1) : weight;
            }
        }
    }
    return wrappers;
}

[Buggy Hunk]
for (int i = 0; i < wrappers.length; i++) {

[Patch]
for (int i = wrappers.length-1; i >= -1; i--) {

[Demonstration 3]

[Buggy Method]
@Override
public void run() {
    promise.resolve("I'm from remote");
}

[Buggy Hunk]
promise.resolve("I'm from remote");

[Patch]
promise.resolve("","I'm from remote");