[Demonstration 1]

[Buggy Method]
@Override
public WebApplicationHandle createWebApplication(String contextPath, Bundle bundle) {
    contextPath = formatContextPath(contextPath);
    try {
        String docBase = determineDocBase(bundle);
        StandardContext context = (StandardContext) this.tomcat.addWebapp(contextPath, docBase, bundle);
        BundleWebappLoader loader = new BundleWebappLoader(bundle, this.classLoaderCustomizer);
        context.setLoader(loader);
        context.setResources(new BundleWebResourceRoot(bundle));
        ServletContext servletContext = context.getServletContext();
        return new TomcatWebApplicationHandle(servletContext, context, loader);
    } catch (Exception ex) {
        throw new ServletContainerException("Unablo te create web application for context path [" + contextPath + "].", ex);
    }
}

[Buggy Hunk]
context.setResources(new BundleWebResourceRoot(bundle));

[Patch]
context.setResources(new BundleWebResourceRoot(bundle, this.tomcat.getUrlConverterTracker()));

[Demonstration 2]

[Buggy Method]
public static void main(String[] args) {
    // Get all user information from csv file and put it in a map
    loginList = new HashMap<>();
    File inputFile = new File(inputPath);
    try {
        inputFileReader = new BufferedReader(new FileReader(inputFile));
        String nextLine;
        while ((nextLine = inputFileReader.readLine()) != null) {
            // System.out.println(nextLine);
            String[] splitLine = nextLine.split(",");
            String userName = splitLine[0];
            String UserType = splitLine[splitLine.length - 1];
            /*
                 * Here, the loginList map is getting something put into it. The
                 * thing that is put is a userName, which is simply a String,
                 * and an AbstractUser of the type read in from the file. The
                 * problem with this approach is that it assumes well-formed
                 * input. If the input file is off by just a little, this will
                 * break hilariously badly. This is just a temporary solution:
                 * Eventually we will be moving to ObjectReaders anyway.
                 */
            if (!loginList.containsKey(userName)) {
                loginList.put(userName, (AbstractUser) Class.forName(UserType).newInstance());
                loginList.get(userName).email = userName;
            }
        }
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        try {
            inputFileReader.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    Scanner in = new Scanner(System.in);
    // Prompt user to log
    System.out.println("Enter your email: ");
    // String userName = in.nextLine();
    // Hardcoded version for easier running later.
    String userName = "testPM@doesntexist.net";
    User currentUser = login(userName);
    if (currentUser instanceof ParkManager) {
        ParkManagerDriver.run(currentUser, in);
    } else if (currentUser instanceof UrbanParksStaffMember) {
        System.out.println("The user was an instance of " + currentUser.getClass() + "!");
    } else if (currentUser instanceof Volunteer) {
        System.out.println("The user was an instance of " + currentUser.getClass() + "!");
    } else {
        System.out.println("Login failed");
    }
    in.close();
}

[Buggy Hunk]
else if (currentUser instanceof UrbanParksStaffMember)

[Patch]
else if (currentUser instanceof UrbanParkStaffMember)

[Demonstration 3]

[Buggy Method]
public static void main(String[] args) throws CloneNotSupportedException {
    Pokedex pd = new Pokedex();
    RaidDex rd = new RaidDex();
    RaidBoss rb = rd.findeRaidBoss("Tyranitar");
    if (PARALLEL)
        IntStream.range(1, 251).parallel().forEach(i -> {
            Pokemon pkm = null;
            try {
                pkm = (Pokemon) pd.getPokemon(i).clone();
            } catch (CloneNotSupportedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            List<QuickMove> attackerQuickmoves = pkm.getQuickMoves();
            List<ChargeMove> attackerChargeMoves = pkm.getChargeMoves();
            List<QuickMove> defenderQuickmoves = rb.getQuickMoves();
            List<ChargeMove> defenderChargeMoves = rb.getChargeMoves();
            for (int level = 0; level < 79; level++) {
                pkm.setLevel(level);
                for (QuickMove aqm : attackerQuickmoves) {
                    for (ChargeMove acm : attackerChargeMoves) {
                        for (QuickMove dqm : defenderQuickmoves) {
                            for (ChargeMove dcm : defenderChargeMoves) {
                                for (int numberOfAttackers = 1; numberOfAttackers <= 2; numberOfAttackers++) {
                                    int it = 0;
                                    RaidSimulator rs = new RaidSimulator(pkm, rb, aqm, dqm, acm, dcm, numberOfAttackers);
                                    while (it < MAX_ITS) {
                                        rs.simulateBatle();
                                        // System.out.println("Done Batling
                                        // " +
                                        // pkm.getName() + " Level: " +
                                        // level +
                                        // "Number Of attackers " +
                                        // numberOfAttackers);
                                        if (rs.didAttackerWin()) {
                                            synchronized (System.out) {
                                                System.out.println("-----------------");
                                                System.out.println("Victory!!!");
                                                System.out.println(numberOfAttackers + " " + pkm.getName() + "'s won at level " + level + " Quick Attack: " + aqm.getName() + " and Charge Move: " + acm.getName());
                                                System.out.println("Versus");
                                                System.out.println(rb.getName() + " with Quick Attack" + dqm.getName() + " and Charge Move:" + dcm.getName());
                                                System.out.println("On try: " + it);
                                                System.out.println("-----------------");
                                            }
                                            numberOfAttackers = 21;
                                            break;
                                        } else if (!rs.wasItClose()) {
                                            break;
                                        }
                                        rs.resetBatle();
                                        it++;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        });
    else {
        for (int i = 1; i <= 251; i++) {
            Pokemon pkm = null;
            try {
                pkm = (Pokemon) pd.getPokemon(i).clone();
            } catch (CloneNotSupportedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            List<QuickMove> attackerQuickmoves = pkm.getQuickMoves();
            List<ChargeMove> attackerChargeMoves = pkm.getChargeMoves();
            List<QuickMove> defenderQuickmoves = rb.getQuickMoves();
            List<ChargeMove> defenderChargeMoves = rb.getChargeMoves();
            for (int level = 0; level < 79; level++) {
                pkm.setLevel(level);
                for (QuickMove aqm : attackerQuickmoves) {
                    for (ChargeMove acm : attackerChargeMoves) {
                        for (QuickMove dqm : defenderQuickmoves) {
                            for (ChargeMove dcm : defenderChargeMoves) {
                                for (int numberOfAttackers = 1; numberOfAttackers <= 20; numberOfAttackers++) {
                                    int it = 0;
                                    RaidSimulator rs = new RaidSimulator(pkm, rb, aqm, dqm, acm, dcm, numberOfAttackers);
                                    while (it < MAX_ITS) {
                                        rs.simulateBatle();
                                        // System.out.println("Done Batling
                                        // " +
                                        // pkm.getName() + " Level: " +
                                        // level +
                                        // "Number Of attackers " +
                                        // numberOfAttackers);
                                        if (rs.didAttackerWin()) {
                                            synchronized (System.out) {
                                                System.out.println("-----------------");
                                                System.out.println("Victory!!!");
                                                System.out.println(numberOfAttackers + " " + pkm.getName() + "'s won at level " + level + " Quick Attack: " + aqm.getName() + " and Charge Move: " + acm.getName());
                                                System.out.println("Versus");
                                                System.out.println(rb.getName() + " with Quick Attack" + dqm.getName() + " and Charge Move:" + dcm.getName());
                                                System.out.println("On try: " + it);
                                                System.out.println("-----------------");
                                            }
                                            numberOfAttackers = 21;
                                            break;
                                        } else if (!rs.wasItClose()) {
                                            break;
                                        }
                                        rs.resetBatle();
                                        it++;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

[Buggy Hunk]
+ "'s won at level " + level + " Quick Attack: "

[Patch]
+ "'s won at level " + level/2.0 + " Quick Attack: "