[Demonstration 1]

[Buggy Method]
public void setLabel(String label, Boolean selected) {
    this.currentLabel = label;
    this.polygon.label = label;
    this.viewOptions.setBlnLabelSelected(selected);
    if (label == null || label.length() == 0) {
        this.drawLabel();
        return;
    }
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setTextAlign(Align.LEFT);
    paint.setTextSize(20);
    paint.setStrokeWidth(12);
    Rect bounds = new Rect();
    paint.getTextBounds(label, 0, label.length(), bounds);
    Bitmap.Config conf = Bitmap.Config.ARGB_8888;
    Bitmap bitmapSelected = Bitmap.createBitmap(bounds.width() + 5, bounds.height(), conf);
    Bitmap bitmap = Bitmap.createBitmap(bounds.width() + 5, bounds.height(), conf);
    float x = 0;
    float y = -1.0f * bounds.top + (bitmap.getHeight() * 0.06f);
    Canvas canvas = new Canvas(bitmap);
    paint.setColor(this.viewOptions.getLabelColor());
    canvas.drawText(label, x, y, paint);
    canvas = new Canvas(bitmapSelected);
    paint.setColor(this.viewOptions.getLabelSelectedColor());
    paint.setShadowLayer(1f, 0f, 1f, Color.DKGRAY);
    canvas.drawText(label, x, y, paint);
    this.iconLabel = BitmapDescriptorFactory.fromBitmap(bitmap);
    this.iconLabelSelected = BitmapDescriptorFactory.fromBitmap(bitmapSelected);
    this.drawLabel();
}

[Buggy Hunk]
if(label == null || label.length() == 0){

[Patch]
if(label == null || label.trim().length() == 0){

[Demonstration 2]

[Buggy Method]
public static void main(String[] argv) {
    try {
        Thread[] threads = new Thread[NUM_THREADS];
        int i, ret;
        Connection conn;
        /*
             * Create a clean test directory for this run of the test program if the
             * environment variable isn't already set (as is done by make check).
             */
        if (System.getenv("WIREDTIGER_HOME") == null) {
            home = "WT_HOME";
            try {
                Process proc = Runtime.getRuntime().exec("/bin/rm -rf " + home);
                BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
                while (br.ready()) System.out.println(br.readLine());
                br.close();
                proc.waitFor();
                if (!(new File(home)).mkdir())
                    System.err.println("mkdir: failed");
            } catch (Exception ex) {
                System.err.println("Exception: " + home + ": " + ex);
                System.exit(1);
            }
        } else
            home = null;
        if ((conn = wiredtiger.open(home, "create")) == null) {
            System.err.println("Error connecting to " + home);
            System.exit(1);
        }
        /* Note: further error checking omitted for clarity. */
        Session session = conn.open_session(null);
        ret = session.create("table:access", "key_format=S,value_format=S");
        Cursor cursor = session.open_cursor("table:access", null, "overwrite");
        cursor.putKeyString("key1");
        cursor.putValueString("value1");
        ret = cursor.insert();
        cursor.close();
        ret = session.close(null);
        for (i = 0; i < NUM_THREADS; i++) {
            threads[i] = new ScanThread(conn);
            threads[i].start();
        }
        for (i = 0; i < NUM_THREADS; i++) try {
            threads[i].join();
            ret = -1;
        } catch (InterruptedException ie) {
        }
        ret = conn.close(null);
        System.exit(ret);
    } catch (WiredTigerException wte) {
        System.err.println("Exception: " + wte);
        wte.printStackTrace();
        System.exit(1);
    }
}

[Buggy Hunk]
threads[i] = new ScanThread(conn);

[Patch]
threads[i] = new InsertThread(conn, i);

[Demonstration 3]

[Buggy Method]
static float[] add(float[] x, float[] y) {
    float[] z = new float[x.length];
    for (int i = 0; i < z.length; i++) {
        z[i] = x[i] + y[i];
    }
    return z;
}

[Buggy Hunk]
static float[] add(float[] x, float[] y) {

[Patch]
private static float[] add(float[] x, float[] y) {