[Demonstration 1]

[Buggy Method]
public static void main(String[] args) {
    String curPath = Paths.get("").toAbsolutePath().toString();
    String fileName = "Pong Starter.sb2";
    String zippedDirLocStr = curPath + "/TestData/" + fileName;
    Student test = new Student(zippedDirLocStr);
    System.out.printf("Sprite Count: %d", test.getSpriteCount());
}

[Buggy Hunk]
String zippedDirLocStr = curPath + "/TestData/" + fileName;

[Patch]
String zippedDirLocStr = curPath + File.separator + "TestData" + File.separator + fileName;

[Demonstration 2]

[Buggy Method]
@Override
public MagicDeck getDeck(RetrievableDeck info) throws Exception {
    HttpGet get = new HttpGet(info.getUrl());
    String responseBody = httpclient.execute(get, responseHandler, httpContext);
    MagicDeck deck = new MagicDeck();
    JsonElement root = new JsonParser().parse(responseBody);
    deck.setName(root.getAsJsonObject().get("name").getAsString());
    deck.setDescription(root.getAsJsonObject().get("url").getAsString());
    for (int i = 0; i < root.getAsJsonObject().get("inventory").getAsJsonArray().size(); i++) {
        JsonArray inv = root.getAsJsonObject().get("inventory").getAsJsonArray().get(i).getAsJsonArray();
        String cardName = inv.get(0).getAsString();
        String position = inv.get(1).getAsJsonObject().get("b").getAsString();
        int qte = inv.get(1).getAsJsonObject().get("qty").getAsInt();
        //remove foil if present
        cardName = cardName.replaceAll("\\*.+?\\*", "").trim();
        //ged ed if present
        String idSet = null;
        Matcher m = Pattern.compile("\\(([^)]+)\\)").matcher(cardName);
        while (m.find()) {
            idSet = (m.group(1));
        }
        cardName = cardName.replaceAll("\\(([^)]+)\\)", "").trim();
        //remove behavior if present
        if (cardName.contains("#")) {
            cardName = cardName.substring(0, cardName.indexOf("#")).trim();
        }
        List<MagicCard> ret;
        if (idSet == null) {
            ret = MTGDesktopCompanionControler.getInstance().getEnabledProviders().searchCardByCriteria("name", cardName, null);
        } else {
            MagicEdition ed = new MagicEdition();
            ed.setId(idSet);
            ret = MTGDesktopCompanionControler.getInstance().getEnabledProviders().searchCardByCriteria("name", cardName, ed);
        }
        if (ret.size() > 0) {
            setChanged();
            notifyObservers(deck.getMap());
            if (position.equalsIgnoreCase("main"))
                deck.getMap().put(ret.get(0), qte);
            else
                deck.getMapSideBoard().put(ret.get(0), qte);
        }
    }
    return deck;
}

[Buggy Hunk]
String responseBody = httpclient.execute(get, responseHandler, httpContext);

[Patch]
String responseBody = EntityUtils.toString(httpclient.execute(get, httpContext).getEntity());

[Demonstration 3]

[Buggy Method]
private Map<String, FilePath> getJobs(AWSDeviceFarm adf, ScheduleRunResult run, FilePath resultsDir) throws IOException, InterruptedException {
    Map<String, FilePath> jobs = new HashMap<String, FilePath>();
    ListJobsResult result = adf.listJobs(run.getRun().getArn());
    for (Job job : result.getJobs()) {
        String arn = job.getArn().split(":")[6];
        String jobId = arn.substring(arn.lastIndexOf("/") + 1);
        // Two jobs can have same name. Appending Os version information to job name
        String osVersion = null;
        if (job.getDevice() != null) {
            osVersion = job.getDevice().getOs();
        }
        jobs.put(arn, new FilePath(resultsDir, job.getName() + "-" + osVersion != null ? osVersion : jobId));
        jobs.get(arn).mkdirs();
    }
    return jobs;
}

[Buggy Hunk]
jobs.put(arn, new FilePath(resultsDir, job.getName() + "-" + osVersion != null ? osVersion : jobId));

[Patch]
jobs.put(arn, new FilePath(resultsDir, job.getName() + "-" + (osVersion != null ? osVersion : jobId)));