[Demonstration 1]

[Buggy Method]
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_edit_profile);
    // Show the Up button in the action bar.
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    // savedInstanceState is non-null when there is fragment state
    // saved from previous configurations of this activity
    // (e.g. when rotating the screen from portrait to landscape).
    // In this case, the fragment will automatically be re-added
    // to its container so we don't need to manually add it.
    // For more information, see the Fragments API guide at:
    //
    // http://developer.android.com/guide/components/fragments.html
    //
    if (savedInstanceState == null) {
        // Create the detail fragment and add it to the activity
        // using a fragment transaction.
        EditProfileFragment fragment = new EditProfileFragment();
        getSupportFragmentManager().beginTransaction().add(R.id.container, fragment).commit();
    }
    ActionBar actionBar = getSupportActionBar();
    BitmapDrawable background = new BitmapDrawable(BitmapFactory.decodeResource(getResources(), R.drawable.topbg));
    background.setTileModeX(Shader.TileMode.REPEAT);
    actionBar.setBackgroundDrawable(background);
    actionBar.setLogo(R.drawable.ic_vikler);
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setDisplayUseLogoEnabled(true);
}

[Buggy Hunk]
BitmapDrawable background = new BitmapDrawable (BitmapFactory.decodeResource(getResources(), R.drawable.topbg));

[Patch]
BitmapDrawable background = (BitmapDrawable)getResources().getDrawable(R.drawable.topbg);

[Demonstration 2]

[Buggy Method]
@Test(groups = { "deep" }, priority = 10)
public void checkElasticSearchInAttachment() {
    try {
        getPageManager().getAdminPage().showDashboard();
        getPageManager().getDashboardPage().addNewExperiment(buildUniqueName(LGConstants.EXPERIMENT_PREFIX));
        getPageManager().getExperimentPage().changeVersion(LGConstants.EXPERIMENT_CURRENT);
        getPageManager().getDashboardPage().uploadFile();
        String text = getPageManager().getAdminPage().searchTextFromAttachment(LGConstants.SEARCH_TEXT);
        Assert.assertEquals(text, LGConstants.UPLOAD_TXT_TEST_FILENAME);
    } catch (Exception e) {
        setLog(e);
        AssertJUnit.fail(e.getMessage());
    }
}

[Buggy Hunk]
getPageManager().getExperimentPage().changeVersion(LGConstants.EXPERIMENT_CURRENT);

[Patch]
getPageManager().getExperimentPage().changeVersion(LGConstants.EXPERIMENT_BETA);

[Demonstration 3]

[Buggy Method]
private RegisteredServiceItem createServiceItem(final RegisteredService service) {
    final RegisteredServiceItem serviceItem = new RegisteredServiceItem();
    serviceItem.setAssignedId(String.valueOf(service.getId()));
    serviceItem.setEvalOrder(service.getEvaluationOrder());
    serviceItem.setName(service.getName());
    serviceItem.setServiceId(service.getServiceId());
    serviceItem.setDescription(service.getDescription().substring(0, service.getDescription().length() > 100 ? 99 : service.getDescription().length()));
    return serviceItem;
}

[Buggy Hunk]
serviceItem.setDescription(service.getDescription().substring(0,service.getDescription().length() > 100 ? 99 : service.getDescription().length()));

[Patch]
serviceItem.setDescription(DigestUtils.abbreviate(service.getDescription()));