[Demonstration 1]

[Buggy Method]
public void fetchUserData() {
    Firebase ref = new Firebase(Config.FIREBASE_URl);
    FirebaseAuth mAuth = FirebaseAuth.getInstance();
    FirebaseUser currentUser = mAuth.getCurrentUser();
    String userName = currentUser.getEmail();
    ref.orderByChild("title").equalTo(query).addChildEventListener(new ChildEventListener() {

        @Override
        public void onChildAdded(DataSnapshot dataSnapshot, String prevChildKey) {
            Story story = dataSnapshot.getValue(Story.class);
            //TODO: make sure this is the best way to add these
            storyAdapter.add(0, story);
        }

        @Override
        public void onChildChanged(DataSnapshot dataSnapshot, String s) {
        }

        @Override
        public void onChildRemoved(DataSnapshot dataSnapshot) {
        }

        @Override
        public void onChildMoved(DataSnapshot dataSnapshot, String s) {
        }

        @Override
        public void onCancelled(FirebaseError firebaseError) {
        }
    });
}

[Buggy Hunk]
ref.orderByChild("title").equalTo(query).addChildEventListener(new ChildEventListener() {

[Patch]
ref.child("stories").orderByChild("title").equalTo(query).addChildEventListener(new ChildEventListener() {

[Demonstration 2]

[Buggy Method]
@Override
public void onStart() {
    super.onStart();
    String savedSubstitutionplanData = sharedPreferences.getString(SUBSTITUTION_PLAN_DATA_KEY, "");
    if (savedSubstitutionplanData != "") {
        displaySubstitutionplan(savedSubstitutionplanData);
    }
    //TODO Add login UI
    updateSubstitutionplan("EbertDan", "qatze2");
}

[Buggy Hunk]
if (savedSubstitutionplanData != "") {

[Patch]
if (!savedSubstitutionplanData.equals("")) {

[Demonstration 3]

[Buggy Method]
public List<Event> getEvents(DocumentReference userReference, boolean onlyUnread, int expectedCount, Date endDate, List<String> blackList) throws NotificationException {
    final int batchSize = expectedCount * 2;
    try {
        // Create the query
        Query query = generateQuery(userReference, onlyUnread, endDate, blackList);
        if (query == null) {
            return Collections.emptyList();
        }
        query.setLimit(batchSize);
        // Get a batch of events
        List<Event> batch = eventStream.searchEvents(query);
        // Add to the results the events the user has the right to see
        List<Event> results = new ArrayList<>();
        for (Event event : batch) {
            DocumentReference document = event.getDocument();
            if (document != null && !authorizationManager.hasAccess(Right.VIEW, userReference, event.getDocument())) {
                continue;
            }
            results.add(event);
            if (results.size() == expectedCount) {
                return results;
            }
        }
        // If we haven't get the expected number of events, perform a new batch
        if (results.size() < expectedCount && batch.size() == batchSize) {
            blackList.addAll(getEventsIds(batch));
            results.addAll(getEvents(userReference, onlyUnread, expectedCount - results.size(), endDate, blackList));
        }
        return results;
    } catch (Exception e) {
        throw new NotificationException("Fail to get the list of notifications.", e);
    }
}

[Buggy Hunk]
public List<Event> getEvents(DocumentReference userReference, boolean onlyUnread, int expectedCount,

[Patch]
private List<Event> getEvents(DocumentReference userReference, boolean onlyUnread, int expectedCount,