[Demonstration 1]

[Buggy Method]
@Override
public boolean onTouch(View view, MotionEvent event) {
    // Perform setup and sanity checks.
    if (type == GameType.REPLAY)
        return false;
    if (view instanceof PieceView) {
        toMove = (PieceView) view;
        layoutParams = (RelativeLayout.LayoutParams) toMove.getLayoutParams();
    } else {
        return false;
    }
    int action = event.getAction();
    switch(action & MotionEvent.ACTION_MASK) {
        // We're beginning to draw a Piece.
        case MotionEvent.ACTION_DOWN:
            // Make sure the chosen Piece is on the right team..
            if (toMove.getPiece().getOwner().equals(game.playerTurn().toString())) {
                ArrayList<Location> validMoves = toMove.getPiece().getValidMoves();
                /* Make sure the selected piece has >= 1 move(s) */
                if (validMoves.size() > 0) {
                    // Save starting location and layout constraints for chosen Piece.
                    originalLocation = (RelativeLayout.LayoutParams) toMove.getLayoutParams();
                    origin = new Location(originalLocation.topMargin, originalLocation.leftMargin, sDim);
                    // Get the starting X and Y coordinates for this touch event.
                    lastX = event.getX();
                    lastY = event.getY();
                    // Functionality allows for multiple pieces to be moved at once, while this isn't allowed having these events eliminated crashes .
                    activePointerId = event.getPointerId(0);
                } else {
                    // Piece has no valid moves, cancel touch event.
                    return false;
                }
            } else {
                // Not this player's turn, cancel touch event.
                return false;
            }
            break;
        // We're in the middle of dragging a piece.
        case MotionEvent.ACTION_MOVE:
            // Get the new X and Y for this touch event and calculate the differential.
            int pointerIndex = event.findPointerIndex(activePointerId);
            float x = event.getX(pointerIndex), y = event.getY(pointerIndex);
            float dx = x - lastX, dy = y - lastY;
            // Update offsets.
            layoutParams.leftMargin += dx;
            layoutParams.topMargin += dy;
            toMove.setLayoutParams(layoutParams);
            break;
        // We're ending the process of dragging a piece.
        case MotionEvent.ACTION_UP:
            // Get initial state.
            Location from = toMove.getPiece().getPos();
            Location move = new Location(layoutParams.topMargin + 44, layoutParams.leftMargin + 44, sDim);
            Move tentative = performMove(new Move(game.playerTurn(), move, from, toMove.getPiece()));
            // Check if the move the user has selected is valid.
            if (tentative != null) {
                if ((toMove.getPiece() instanceof Pawn || toMove.getPiece() instanceof Enpassant) && toMove.getPiece().getUpgradeLoc() == move.getI()) {
                    promoted = toMove.getPiece();
                    updatePiece();
                }
                if (type == GameType.COMPUTER || type == GameType.REMOTE)
                    runOpponentMove(tentative);
            } else {
                // User has selected an invalid move. Reset Piece offsets to their original values.
                layoutParams.leftMargin = (sDim / 8) * origin.getJ();
                layoutParams.topMargin = (sDim / 8) * origin.getI();
                toMove.setLayoutParams(layoutParams);
            }
            activePointerId = -1;
            break;
        // Drag event was canceled.
        case MotionEvent.ACTION_CANCEL:
            activePointerId = -1;
            break;
    }
    return true;
}

[Buggy Hunk]
Location move = new Location(layoutParams.topMargin + 44, layoutParams.leftMargin + 44, sDim);

[Patch]
Location move = new Location(layoutParams.topMargin + ((sDim/8)/2), layoutParams.leftMargin + ((sDim/8)/2), sDim);

[Demonstration 2]

[Buggy Method]
public void draw(GOut g) {
    GSprite spr = item.spr();
    if (spr != null) {
        Coord sz = spr.sz();
        g.defstate();
        if (olcol.get() != null)
            g.usestate(new ColorMask(olcol.get()));
        drawmain(g, spr);
        g.defstate();
        if (item.num >= 0) {
            g.atext(Integer.toString(item.num), sz, 0, 1);
        } else if (itemnum.get() != null) {
            g.aimage(itemnum.get(), sz, 1, 1);
        }
        if (item.meter > 0) {
            double a = ((double) item.meter) / 100.0;
            g.chcolor(255, 255, 255, 64);
            Coord half = sz.div(2);
            g.prect(half, half.inv(), half, a * Math.PI * 2);
            g.chcolor();
        }
        if (Shovel.getSettings().showQuality && item.ready()) {
            ItemQualityInfo qualityInfo = item.getItemQualityInfo();
            g.aimage(Utils.renderOutlinedFont(Text.std, Integer.toString(qualityInfo.getMaxValue()), qualityInfo.getMaxColor(), Utils.contrast(qualityInfo.getMaxColor()), 1), sz, 1, 1);
            g.chcolor();
        }
    } else {
        g.image(missing.layer(Resource.imgc).tex(), Coord.z, sz);
    }
}

[Buggy Hunk]
g.aimage(Utils.renderOutlinedFont(Text.std, Integer.toString(qualityInfo.getMaxValue()), qualityInfo.getMaxColor(), Utils.contrast(qualityInfo.getMaxColor()), 1), sz, 1, 1);

[Patch]
g.aimage(Utils.renderOutlinedFont(Text.std, Integer.toString(qualityInfo.getMaxValue()), qualityInfo.getMaxColor(), Color.BLACK, 1), sz, 1, 1);

[Demonstration 3]

[Buggy Method]
public Seat getSeat(String seat) {
    for (int i = 0; i < vipSeats.size(); i++) {
        if (seat == vipSeats.get(i).getId())
            return vipSeats.get(i);
    }
    for (int i = 0; i < vipSeats.size(); i++) {
        if (seat == regularSeats.get(i).getId())
            return regularSeats.get(i);
    }
    return null;
}

[Buggy Hunk]
for (int i = 0; i < vipSeats.size(); i++)

[Patch]
for (int i = 0; i < regularSeats.size(); i++)