[Demonstration 1]

[Buggy Method]
public static void deactivateTenant(String tenantDomain) throws RestAPIException {
    TenantManager tenantManager = ServiceHolder.getTenantManager();
    int tenantId;
    try {
        tenantId = tenantManager.getTenantId(tenantDomain);
        if (tenantId != -1) {
            try {
                TenantMgtUtil.deactivateTenant(tenantDomain, tenantManager, tenantId);
            } catch (Exception e) {
                String msg = "Error in deactivating Tenant :" + tenantDomain;
                log.error(msg, e);
                throw new RestAPIException(msg, e);
            }
            //Notify tenant deactivation all listeners
            try {
                TenantMgtUtil.triggerTenantDeactivation(tenantId);
            } catch (StratosException e) {
                String msg = "Error in notifying tenant deactivate.";
                log.error(msg, e);
                throw new RestAPIException(msg, e);
            }
        } else {
            String msg = "The tenant with domain name: " + tenantDomain + " does not exist.";
            throw new RestAPIException(msg);
        }
    } catch (UserStoreException e) {
        String msg = "Error in retrieving the tenant id for the tenant domain: " + tenantDomain + ".";
        log.error(msg, e);
        throw new RestAPIException(msg, e);
    }
}

[Buggy Hunk]
throw new RestAPIException(msg);

[Patch]
throw new InvalidDomainException(msg);

[Demonstration 2]

[Buggy Method]
private void setAdsName(int i, AdListingData data) {
    TableRow row = new TableRow(this);
    View v = LayoutInflater.from(this).inflate(R.layout.row_textview, row, false);
    TextView tv = (TextView) v.findViewById(R.id.text_view);
    tv.setText(data.getAd());
    tlName.addView(v, i);
}

[Buggy Hunk]
View v = LayoutInflater.from(this).inflate(R.layout.row_textview, row, false);

[Patch]
View v = LayoutInflater.from(this).inflate(R.layout.first_row, row, false);