[Demonstration 1]

[Buggy Method]
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_activity);
    // Set startup fragment.
    Fragment fragment;
    if (WifiConnector.getWifiState() == WifiState.ENABLED) {
        fragment = m_WifiChooserFragment.get();
    } else {
        fragment = m_WifiIsDisabledFragment.get();
    }
    getSupportFragmentManager().beginTransaction().add(R.id.MainActivity_fragment_frame, fragment).commit();
    WifiBroadcastReceiver.attach(m_OnWifiDisabledListener);
    WifiBroadcastReceiver.attach(m_OnWifiEnabledListener);
}

[Buggy Hunk]
getSupportFragmentManager().beginTransaction().add(

[Patch]
getSupportFragmentManager().beginTransaction().replace(

[Demonstration 2]

[Buggy Method]
private Map<String, List<CustomWfDefinition>> getWfDefinitionsByType(Map<WfDefinition, List<WfDefinition>> definitions) {
    Map grouppedDefinitionsMap = new HashMap<String, List<CustomWfDefinition>>();
    for (Map.Entry<WfDefinition, List<WfDefinition>> entry : definitions.entrySet()) {
        WfDefinition definition = entry.getKey();
        String[] categories = definition.getCategories();
        List<WfDefinition> historyDefinitions = entry.getValue();
        Map historyDefinitionsMap = null;
        removeExistedDefinitionFromHistory(definition, historyDefinitions);
        if (!historyDefinitions.isEmpty()) {
            historyDefinitionsMap = new HashMap<String, List<CustomWfHistoryDefinition>>();
            List<CustomWfHistoryDefinition> customWfHistoryDefinitions = new ArrayList();
            for (WfDefinition historyDefinition : historyDefinitions) {
                customWfHistoryDefinitions.add(new CustomWfHistoryDefinition(historyDefinition.getVersion().toString(), historyDefinition.getId()));
            }
            historyDefinitionsMap.put(Localization.getString("ImportParWizardPage.page.oldDefinitionVersions"), customWfHistoryDefinitions);
        }
        for (String category : categories) {
            if (!grouppedDefinitionsMap.containsKey(category)) {
                List<CustomWfDefinition> newDefinitionlist = new ArrayList<CustomWfDefinition>();
                newDefinitionlist.add(new CustomWfDefinition(definition.getName(), definition.getId(), historyDefinitionsMap));
                grouppedDefinitionsMap.put(category, newDefinitionlist);
            } else {
                List existedDefinitionlist = (List) grouppedDefinitionsMap.get(category);
                existedDefinitionlist.add(new CustomWfDefinition(definition.getName(), definition.getId(), historyDefinitionsMap));
            }
        }
    }
    return new TreeMap<>(grouppedDefinitionsMap);
}

[Buggy Hunk]
customWfHistoryDefinitions.add(new CustomWfHistoryDefinition(historyDefinition.getVersion().toString(), historyDefinition.getId()));

[Patch]
customWfHistoryDefinitions.add(new CustomWfHistoryDefinition(historyDefinition.getName(), historyDefinition.getId(), historyDefinition.getVersion()));

[Demonstration 3]

[Buggy Method]
@Override
public List<String> load(String dbName) throws Exception {
    try {
        MongoDatabase db = client.getDatabase(dbName);
        List<String> collectionNames = new ArrayList<>();
        db.listCollectionNames().into(collectionNames);
        return collectionNames;
    } catch (MongoException me) {
        logger.warn("Failure while getting collection names from '{}'. {}", dbName, me.getMessage());
        return Collections.emptyList();
    } catch (Exception e) {
        throw new DrillRuntimeException(e.getMessage(), e);
    }
}

[Buggy Hunk]
MongoDatabase db = client.getDatabase(dbName);

[Patch]
MongoDatabase db = plugin.getClient().getDatabase(dbName);