[Demonstration 1]

[Buggy Method]
private boolean fillCostAndSizeArray() {
    GPDLogger.info(this, String.format("Filling the cost array."));
    Stopwatch stopwatch;
    List<Query> queries = workload.getQueries();
    if (useRegression || sizeLimit > 0) {
        extractor.initialize(sampleDBs, dbInfo.getTargetDBName(), schema);
    }
    // fill cost array from each sample database.
    for (int d = 0; d < numSampleDBs; ++d) {
        String dbName = sampleDBs.get(d).getDbName();
        Statement stmt;
        try {
            conn.setCatalog(dbName);
            stmt = conn.createStatement();
        } catch (SQLException e) {
            GPDLogger.error(this, "A SQLException has been caught.");
            e.printStackTrace();
            ;
            return false;
        }
        for (int j = 0; j < configurations.size(); ++j) {
            List<Structure> configuration = configurations.get(j);
            // build structures
            GPDLogger.info(this, String.format("Building structures for configuration #%d out of %d.", j + 1, configurations.size()));
            for (Structure s : configuration) {
                s.create(conn);
                extractor.addTrainingDataForSize(dbName, schema, s);
            }
            GPDLogger.info(this, String.format("Running queries for configuration #%d out of %d.", j + 1, configurations.size()));
            for (int i = 0; i < queries.size(); ++i) {
                Query q = queries.get(i);
                stopwatch = Stopwatch.createStarted();
                boolean isTimedOut = false;
                try {
                    stmt.setQueryTimeout(GPDMain.userInput.getSetting().getQueryTimeout());
                    stmt.execute(q.getContent());
                } catch (SQLException e) {
                    GPDLogger.info(this, String.format("Query #%d has been timed out. Assigning " + "maximum cost.", i));
                    isTimedOut = true;
                }
                double queryTime = stopwatch.elapsed(TimeUnit.MILLISECONDS);
                // when query times out, we assign INT_MAX to its cost.
                if (isTimedOut) {
                    rawCostArray[d][i][j] = (long) Integer.MAX_VALUE;
                } else {
                    rawCostArray[d][i][j] = (long) queryTime;
                }
                extractor.addTrainingData(dbName, schema, q, j, queryTime);
            }
            // remove structures
            GPDLogger.info(this, String.format("Removing structures for configuration #%d out of %d.", j + 1, configurations.size()));
            for (Structure s : configuration) {
                s.drop(conn);
            }
        }
    }
    GPDSMORegression sr = new GPDSMORegression();
    if (useRegression) {
        if (!sr.build(extractor.getTrainData())) {
            return false;
        }
    }
    for (int j = 0; j < configurations.size(); ++j) {
        for (int i = 0; i < queries.size(); ++i) {
            if (useRegression) {
                Query q = queries.get(i);
                Instance testInstance = extractor.getTestInstance(dbInfo.getTargetDBName(), schema, q, j);
                costArray[i][j] = sr.regress(testInstance);
            } else {
                long total = 0;
                for (int d = 0; d < numSampleDBs; ++d) {
                    total += rawCostArray[d][i][j];
                }
                costArray[i][j] = total / numSampleDBs;
            }
        }
    }
    return true;
}

[Buggy Hunk]
e.printStackTrace();;

[Patch]
e.printStackTrace();

[Demonstration 2]

[Buggy Method]
@RequestMapping(value = "/profile", method = RequestMethod.GET)
public ModelAndView profile(@RequestParam("userId") long id) {
    ModelAndView model;
    try {
        model = new ModelAndView("profile");
        model.addObject("lectures", studentDao.findOne(id).getLectures().toArray());
        model.addObject("student", studentDao.findOne(id));
    } catch (InvalidUserException e) {
        model = new ModelAndView("index");
        model.addObject("page_error", e.getMessage());
    }
    return model;
}

[Buggy Hunk]
model = new ModelAndView("profile");

[Patch]
model = new ModelAndView("profile?userId="+id);

[Demonstration 3]

[Buggy Method]
private boolean foundInMeetingLists(List<Account> list, Account account) {
    boolean success = false;
    if (list != null) {
        return success;
    }
    for (Account a : list) {
        if (account.getId() == a.getId()) {
            success = true;
            break;
        }
    }
    return success;
}

[Buggy Hunk]
if (list != null) {

[Patch]
if (list == null) {