[Demonstration 1]

[Buggy Method]
public void draw() {
    //makes the window 2x2
    this.scale(width / 2.5f, -height / 2.5f);
    //make positive y up and center of window 0,0
    translate(1, -1);
    noStroke();
    background(200, 200, 200);
    // leave trails instead of clearing background \
    //noStroke();
    //fill(0,0,0, 10);
    //rect(-1,-1, 2, 2); //draw transparent rect of the window
    KinectBodyData bodyData = kinectReader.getMostRecentData();
    Body person = bodyData.getPerson(0);
    if (person != null) {
        PVector head = person.getJoint(Body.HEAD);
        PVector spine = person.getJoint(Body.SPINE_SHOULDER);
        PVector spineBase = person.getJoint(Body.SPINE_BASE);
        PVector shoulderLeft = person.getJoint(Body.SHOULDER_LEFT);
        PVector shoulderRight = person.getJoint(Body.SHOULDER_RIGHT);
        PVector footLeft = person.getJoint(Body.FOOT_LEFT);
        PVector footRight = person.getJoint(Body.FOOT_RIGHT);
        PVector handLeft = person.getJoint(Body.HAND_LEFT);
        PVector handRight = person.getJoint(Body.HAND_RIGHT);
        System.out.println("head" + head);
        fill(255, 255, 255);
        noStroke();
        drawIfValid(head, 1);
        drawIfValid(spine, 2);
        drawIfValid(spineBase, 3);
        drawIfValid(shoulderLeft, 4);
        drawIfValid(shoulderRight, 5);
        drawIfValid(footLeft, 6);
        drawIfValid(footRight, 7);
        drawIfValid(handLeft, 8);
        drawIfValid(handRight, 1);
        if ((shoulderLeft != null) && (shoulderRight != null) && (handLeft != null) && (handRight != null)) {
            stroke(255, 0, 0, 100);
            noFill();
            // because of scale weight needs to be much thinner
            strokeWeight(.05f);
            curve(handLeft.x, handLeft.y, shoulderLeft.x, shoulderLeft.y, shoulderRight.x, shoulderRight.y, handRight.x, handRight.y);
        }
    }
}

[Buggy Hunk]
background(200,200,200);

[Patch]
background(0);

[Demonstration 2]

[Buggy Method]
public void addOrUpdateTodo(Todos todo) {
    SQLiteDatabase db = getWritableDatabase();
    db.beginTransaction();
    long id = -1;
    try {
        ContentValues values = new ContentValues();
        values.put(KEY_TODO_VALUE, todo.value);
        values.put(KEY_TODO_ID, todo.id);
        // First try to update the item in case that already exists in the database
        int rows = db.update(TABLE_TODOS, values, KEY_TODO_VALUE + "= ?", new String[] { String.valueOf(todo.value) });
        // Check if update succeeded
        if (rows == 1) {
            // Get the primary key of the user we just updated
            String usersSelectQuery = String.format("SELECT %s FROM %s WHERE %s = ?", KEY_TODO_ID, TABLE_TODOS, KEY_TODO_VALUE);
            Cursor cursor = db.rawQuery(usersSelectQuery, new String[] { String.valueOf(todo.value) });
            try {
                if (cursor.moveToFirst()) {
                    id = cursor.getInt(0);
                    db.setTransactionSuccessful();
                }
            } finally {
                if (cursor != null && !cursor.isClosed()) {
                    cursor.close();
                }
            }
        } else {
            // insert new
            id = db.insertOrThrow(TABLE_TODOS, null, values);
            db.setTransactionSuccessful();
        }
    } catch (Exception e) {
        Log.d(ERR_TAG, "Error while trying to add or update item");
    } finally {
        db.endTransaction();
    }
}

[Buggy Hunk]
int rows = db.update(TABLE_TODOS, values, KEY_TODO_VALUE + "= ?", new String[]{String.valueOf(todo.value)});

[Patch]
int rows = db.update(TABLE_TODOS, values, KEY_TODO_ID + "= ?", new String[]{String.valueOf(todo.id)});

[Demonstration 3]

[Buggy Method]
public void startModelValidating() {
    if (!isModelValid() && !validationStarted) {
        validationStarted = true;
        EventQueue.invokeLater(() -> {
            Scripts.LocalContext context = Scripts.getContext();
            RP.execute(() -> {
                Scripts.setContext(context);
                try {
                    validateModel();
                } catch (Exception ex) {
                    Logger.getLogger(PlatypusDataObject.class.getName()).log(Level.WARNING, ex.getMessage(), ex);
                } finally {
                    Scripts.setContext(null);
                    EventQueue.invokeLater(() -> {
                        validationStarted = false;
                        setModelValid(true);
                    });
                }
            });
        });
    }
}

[Buggy Hunk]
Logger.getLogger(PlatypusDataObject.class.getName()).log(Level.WARNING, ex.getMessage(), ex);

[Patch]
Logger.getLogger(PlatypusDataObject.class.getName()).log(Level.INFO, ex.getMessage(), ex);