[Demonstration 1]

[Buggy Method]
private void searchBluetoothDevice() {
    Set<BluetoothDevice> bondedDevice = bluetoothAdapter.getBondedDevices();
    Iterator<BluetoothDevice> it = bondedDevice.iterator();
    boolean flag = false;
    while (it.hasNext()) {
        BluetoothDevice blue = it.next();
        Log.d(TAG, "onActivityResult: name: " + blue.getName());
        Log.d(TAG, "onActivityResult: address: " + blue.getAddress());
        if (blue.getAddress().equals(deviceAddress)) {
            flag = true;
            break;
        }
    }
    if (flag) {
        //已经配对设备，直接进行链接
        Log.d(TAG, "onActivityResult: 已经配对，直接进行连接");
        clientThread = new ClientThread();
        isTryingConnecting = true;
        clientThread.start();
    } else {
        //搜索蓝牙进行配对
        if (bluetoothAdapter.isDiscovering()) {
            //正在查找
            Log.d(TAG, "onClick: 正在查找设备");
        } else {
            bluetoothAdapter.startDiscovery();
        }
    }
}

[Buggy Hunk]
if (blue.getAddress().equals(deviceAddress)) {

[Patch]
if (blue.getAddress().equalsIgnoreCase(deviceAddress)) {

[Demonstration 2]

[Buggy Method]
@Override
protected void onCreate(Bundle savedInstanceState) {
    Util.setTheme(this);
    super.onCreate(savedInstanceState);
    if (getCallingActivity() != null || !BundleScrubber.scrub(getIntent())) {
        if (getCallingActivity().getPackageName().startsWith("net.dinglisch.android.taskerm") || getCallingActivity().getPackageName().startsWith("com.twofortyfouram.locale")) {
            taskerMode = true;
        }
    } else {
        finish();
        return;
    }
    final Bundle extra = getIntent().getBundleExtra("com.twofortyfouram.locale.intent.extra.BUNDLE");
    if (BundleScrubber.scrub(extra)) {
        finish();
        return;
    }
    setContentView(R.layout.activity_action_config);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    setTitle(getString(R.string.app_name) + " Actions");
    if (taskerMode && !PreferenceManager.getDefaultSharedPreferences(this).getBoolean(Common.ENABLE_TASKER, false)) {
        findViewById(R.id.tasker_warning).setVisibility(View.VISIBLE);
        findViewById(R.id.tasker_config_main).setVisibility(View.GONE);
        return;
    }
    final RadioGroup options = (RadioGroup) findViewById(R.id.tasker_config_options);
    final Button apply = (Button) findViewById(R.id.tasker_apply_button);
    apply.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            int checked = options.getCheckedRadioButtonId();
            result = new Intent();
            if (taskerMode) {
                Bundle resultBundle = new Bundle();
                resultBundle.putInt(ACTION_EXTRA_KEY, ActionsHelper.getKey(checked));
                result.putExtra("com.twofortyfouram.locale.intent.extra.BUNDLE", resultBundle);
                result.putExtra("com.twofortyfouram.locale.intent.extra.BLURB", ((RadioButton) findViewById(checked)).getText().toString());
            } else {
                Intent shortcut = new Intent(ActionConfigActivity.this, ActionActivity.class);
                shortcut.putExtra(ACTION_EXTRA_KEY, getKey(checked));
                result.putExtra(Intent.EXTRA_SHORTCUT_NAME, ((RadioButton) findViewById(checked)).getText().toString());
                result.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(getApplicationContext(), R.mipmap.ic_launcher));
                result.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcut);
            }
            finish();
        }
    });
}

[Buggy Hunk]
if (getCallingActivity() != null || !BundleScrubber.scrub(getIntent())) {

[Patch]
if (getCallingActivity() != null && !BundleScrubber.scrub(getIntent())) {

[Demonstration 3]

[Buggy Method]
private void treeBuilder() {
    while (true) {
        synchronized (mTree) {
            synchronized (this) {
                notify();
            }
            boolean minBuild = false;
            while (!minBuild) {
                while (mTree.addNode()) {
                }
                Log.d("ComputerPlayer", "treeBuilder(): completed tree level " + mTree.getMaxCompleteLevel() + ", size: " + mTree.size());
                if (mTree.getMaxCompleteLevel() >= MIN_BUILD_LEVEL) {
                    minBuild = true;
                }
            }
        }
        Log.d("ComputerPlayer", "treeBuilder(): min build is done, can accept move");
        while (mTree.getMaxCompleteLevel() < MAX_BUILD_LEVEL) {
            synchronized (mTree) {
                mTree.addNode();
            }
        }
        synchronized (mTree) {
            if (mTree.getMaxCompleteLevel() >= MAX_BUILD_LEVEL) {
                try {
                    Log.d("ComputerPlayer", "treeBuilder(): completed tree level " + mTree.getMaxCompleteLevel() + ", size: " + mTree.size() + ", going to sleep");
                    mTree.wait();
                    Log.d("ComputerPlayer", "treeBuilder(): woken up");
                } catch (InterruptedException e) {
                    Log.e("ComputerPlayer", "treeBuilder(): caught interruptedexception", e);
                }
            }
        }
    }
}

[Buggy Hunk]
boolean minBuild = false;

[Patch]
boolean minBuild = (mTree.getMaxCompleteLevel() >= MIN_BUILD_LEVEL);