[Demonstration 1]

[Buggy Method]
private int compute() {
    if (data1.isEmpty() || data2.isEmpty())
        return 1;
    double v1 = Double.parseDouble(data1);
    double v2 = Double.parseDouble(data2);
    double result = 0;
    switch(operation) {
        case add:
            result = v1 + v2;
            break;
        case minus:
            result = v1 - v2;
            break;
        case divide:
            result = v1 / v2;
            break;
        case multiply:
            result = v1 * v2;
            break;
        default:
            //TODO error.
            break;
    }
    DecimalFormat df = new DecimalFormat("0.###");
    data1 = df.format(result);
    data2 = "";
    operation = op.no_op;
    equation = data1;
    return 0;
}

[Buggy Hunk]
if(data1.isEmpty() || data2.isEmpty())

[Patch]
if(data1.isEmpty() || data2.isEmpty() || data2.equals(" "))

[Demonstration 2]

[Buggy Method]
protected void injectNameAndLabelToStack(Metric metric) {
    int nameVar = aa.newLocal(Type.getType(String.class));
    aa.visitLdcInsn(metric.getName());
    aa.visitVarInsn(ASTORE, nameVar);
    List<String> labelValues = LabelUtil.getLabelValues(metric.getLabels());
    if (labelValues != null && !labelValues.isEmpty()) {
        int labelVar = injectLabelValuesArrayToStack(metric, labelValues);
        aa.visitVarInsn(ALOAD, nameVar);
        aa.visitVarInsn(ALOAD, labelVar);
    } else {
        aa.visitVarInsn(ALOAD, nameVar);
        aa.visitInsn(ACONST_NULL);
    }
}

[Buggy Hunk]
if (labelValues != null && !labelValues.isEmpty()) {

[Patch]
if (isNotEmpty(labelValues)) {

[Demonstration 3]

[Buggy Method]
private int findEndCity(int ndx) {
    // If there is no city list, obviously there is no city
    if (mWordCities == null)
        return -1;
    // If this call should ignore any listed cities, return now
    if (isFlagSet(FLAG_NO_CITY))
        return -1;
    // See if we can find the end of a city sequence
    // If not, then return -1;
    int endNdx = mWordCities.findEndSequence(ndx);
    if (endNdx < 0)
        return -1;
    // Under no circumstances will we accept a city ending with "CO" or "COUNTY"
    // that is followed by the word "LINE" or "LIN".
    if (endNdx < tokens.length) {
        String lastWord = tokens[endNdx - 1].toUpperCase();
        if (lastWord.equals("CO") || lastWord.equals("COUNTY")) {
            lastWord = tokens[endNdx].toUpperCase();
            if (lastWord.equals("LINE") || lastWord.equals("LIN"))
                return -1;
        }
    }
    // We found a real city.  But....
    // Doesn't count if anchor end requested and this isn't the end of the tokens
    if (isFlagSet(FLAG_ANCHOR_END) && endNdx != tokens.length)
        return -1;
    // We don't want to return this as a city if it look it might by a street
    // named after that city :(
    // But we do not have to worry about that if we are only parsing a city name
    if (isFlagSet(FLAG_ONLY_CITY) && !isFlagSet(FLAG_ONLY_CROSS))
        return endNdx;
    // OK, we have to do this....
    // If the city is followed by a road suffix, disqualify it
    // Unless the road suffix is followed by a road suffix
    if (!isType(endNdx, ID_NOT_ADDRESS | ID_CROSS_STREET)) {
        if (isRoadSuffix(endNdx) || isRoadSuffix(endNdx + 1)) {
            // Or unless there might be a following cross street, and the street suffix
            // found after the city can start a valid road name in its own right
            if (!isFlagSet(FLAG_CROSS_FOLLOWS) || findRoadEnd(endNdx, 1, true) < 0)
                return -1;
        }
    }
    // Looks good, lets return this
    return endNdx;
}

[Buggy Hunk]
if (!isType(endNdx, ID_NOT_ADDRESS | ID_CROSS_STREET)) {

[Patch]
if (!isType(endNdx, ID_NOT_ADDRESS | ID_CROSS_STREET | ID_NEAR)) {