[Demonstration 1]

[Buggy Method]
@Override
public void run() {
    try {
        String token = GoogleAuthUtil.getTokenWithNotification(ctx, GetAccountName(ctx), GetOauth2Scope(), new Bundle());
        GDocsHelper.SaveAuthToken(ctx, token);
        Utilities.LogDebug(token);
        String gpsLoggerFolderId = GetFileIdFromFileName(token, "GPSLogger For Android");
        if (Utilities.IsNullOrEmpty(gpsLoggerFolderId)) {
            //Couldn't find folder, must create it
            gpsLoggerFolderId = CreateEmptyFile(token, "GPSLogger For Android", GetMimeTypeFromFileName(fileName), "root");
            if (Utilities.IsNullOrEmpty(gpsLoggerFolderId)) {
                callback.OnFailure();
                return;
            }
        }
        //Now search for the file
        String gpxFileId = GetFileIdFromFileName(token, fileName);
        if (Utilities.IsNullOrEmpty(gpxFileId)) {
            //Create empty file first
            gpxFileId = CreateEmptyFile(token, fileName, GetMimeTypeFromFileName(fileName), gpsLoggerFolderId);
            if (Utilities.IsNullOrEmpty(gpxFileId)) {
                callback.OnFailure();
                return;
            }
        }
        if (!Utilities.IsNullOrEmpty(gpxFileId)) {
            //Set file's contents
            UpdateFileContents(token, gpxFileId, Utilities.GetByteArrayFromInputStream(inputStream), fileName);
        }
        callback.OnComplete();
    } catch (Exception e) {
        Utilities.LogError("GDocsUploadHandler", e);
        callback.OnFailure();
    }
}

[Buggy Hunk]
gpsLoggerFolderId = CreateEmptyFile(token, "GPSLogger For Android", GetMimeTypeFromFileName(fileName), "root");

[Patch]
gpsLoggerFolderId = CreateEmptyFile(token, "GPSLogger For Android", "application/vnd.google-apps.folder", "root");

[Demonstration 2]

[Buggy Method]
protected final void fireVariableChanged(T value) {
    for (EzVarListener<T> l : listeners) l.variableChanged(this, value);
    if (getUI() != null) {
        updateVisibilityChain();
        getUI().repack(true);
    }
}

[Buggy Hunk]
if (getUI() != null)

[Patch]
if (getUI() != null && guiInitialized)

[Demonstration 3]

[Buggy Method]
public static Value parseValue(String type, String value) {
    switch(type) {
        case "bool":
            if (value.equals("0") || value.equals("false")) {
                return BooleanValue.FALSE;
            } else if (value.equals("1") || value.equals("true")) {
                return BooleanValue.TRUE;
            }
            break;
        case "int":
            return new IntegerValue(new BigInteger(value));
        case "real":
            String[] strs = value.split("/");
            if (strs.length <= 2) {
                BigInteger num = new BigInteger(strs[0]);
                BigInteger denom = strs.length > 1 ? new BigInteger(strs[1]) : BigInteger.ONE;
                return new RealValue(new BigFraction(num, denom));
            }
            break;
        default:
            if (Character.isAlphabetic(value.charAt(0))) {
                return new EnumValue(value);
            } else {
                throw new IllegalArgumentException("Invalid enumeration value: " + value);
            }
    }
    throw new JKindException("Unable to parse " + value + " as " + type);
}

[Buggy Hunk]
if (Character.isAlphabetic(value.charAt(0))) {

[Patch]
if (value.isEmpty() || Character.isAlphabetic(value.charAt(0))) {