[Demonstration 1]

[Buggy Method]
private void setAxisBackgroundColor(Canvas canvas, final AxisBackgroundColor bg, int position, final Paint fillPaint) {
    fillPaint.setColor(bg.color);
    fillPaint.setAlpha(bg.alpha);
    float rawLeft, rawRight, rawTop, rawBottom;
    rawLeft = rawRight = rawTop = rawBottom = 0;
    final Rect contentRect = computator.getContentRectMinusAllMargins();
    final Viewport viewport = computator.getCurrentViewport();
    if (LEFT == position || RIGHT == position) {
        rawLeft = contentRect.left;
        rawRight = contentRect.right;
        rawBottom = computator.computeRawY(viewport.bottom > bg.start ? viewport.bottom : bg.start);
        rawTop = computator.computeRawY(viewport.top < bg.end ? viewport.top : bg.end);
    } else if (BOTTOM == position || TOP == position) {
        rawBottom = contentRect.bottom;
        rawTop = contentRect.top;
        rawLeft = computator.computeRawX(viewport.left > bg.start ? viewport.left : bg.start);
        rawRight = computator.computeRawX(viewport.right < bg.end ? viewport.right : bg.end);
    } else {
        return;
    }
    canvas.drawRect(rawLeft, rawTop, rawRight, rawBottom, fillPaint);
}

[Buggy Hunk]
final Viewport viewport = computator.getCurrentViewport();

[Patch]
final Viewport viewport = computator.getVisibleViewport();

[Demonstration 2]

[Buggy Method]
public static void showToast(final Context context, final View view, final Integer duration, final Integer x, final Integer y) {
    if (view == null)
        return;
    if (handler == null) {
        handler = new Handler(Looper.getMainLooper());
    }
    handler.post(new Runnable() {

        @Override
        public void run() {
            if (viewToast == null) {
                viewToast = new Toast(context);
                if (duration != null) {
                    viewToast.setDuration(duration);
                }
                if (x != null && y != null) {
                    viewToast.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM, x, y);
                }
                viewToast.setView(view);
                oldView = view;
                viewToast.show();
                oneTimeView = System.currentTimeMillis();
            } else {
                twoTimeView = System.currentTimeMillis();
                if (view.equals(oldView)) {
                    //only show msg when time elapse or show a different msg
                    if (twoTimeView - oneTimeView > LENGTH) {
                        viewToast.show();
                    }
                } else {
                    oldView = view;
                    viewToast.setView(view);
                    viewToast.show();
                }
            }
            oneTimeView = twoTimeView;
        }
    });
}

[Buggy Hunk]
if (view == null)

[Patch]
if (context == null || view == null)

[Demonstration 3]

[Buggy Method]
@Override
public NotarySeal notarizeDocument(String documentType, String document, NotaryKey notaryKey) {
    logger.entry(documentType, document, notaryKey);
    logger.debug("Verifying that the notary key has not expired...");
    Map<String, Object> errors = new LinkedHashMap<>();
    Watermark watermark = notaryKey.watermark;
    validateWatermark(watermark, errors);
    throwExceptionOnErrors("notary.key.has.expired", errors);
    logger.debug("Creating the notary seal attributes...");
    SealAttributes attributes = new SealAttributes();
    attributes.documentType = documentType;
    attributes.documentHash = hashDocument(document);
    attributes.verificationCitation = notaryKey.verificationCitation;
    attributes.watermark = new Watermark();
    logger.debug("Signing the notary seal...");
    NotarySeal seal = new NotarySeal();
    PrivateKey signingKey = notaryKey.signingKey;
    seal.attributes = attributes;
    seal.selfSignature = generateDocumentSignature(attributes.toString(), signingKey);
    logger.exit(seal);
    return seal;
}

[Buggy Hunk]
attributes.watermark = new Watermark();

[Patch]
attributes.watermark = generateWatermark(Notarization.VALID_FOR_FOREVER);