[Demonstration 1]

[Buggy Method]
protected static Set<ResourceLocation> getResourcesFromZip(ZipFile zip, String modid, String name) {
    Set<ResourceLocation> resources = new HashSet<>();
    for (Enumeration<? extends ZipEntry> entries = zip.entries(); entries.hasMoreElements(); ) {
        ZipEntry entry = entries.nextElement();
        if (entry.isDirectory())
            continue;
        Path entryPath = Paths.get(entry.getName());
        if (entryPath.getNameCount() < 5)
            continue;
        if (!entryPath.getName(0).getFileName().toString().equals("assets"))
            continue;
        if (!entryPath.getName(1).getFileName().toString().equals(modid))
            continue;
        if (!entryPath.getName(2).getFileName().toString().equals(name))
            continue;
        if (!isModLoaded(entryPath.getName(3).getFileName().toString()))
            continue;
        if (!entryPath.getFileName().toString().endsWith(".json"))
            continue;
        resources.add(new ResourceLocation(entryPath.getName(1).getFileName().toString(), entryPath.relativize(entryPath.getName(1)).toString().replace('\\', '/')));
    }
    return resources;
}

[Buggy Hunk]
entryPath.relativize(entryPath.getName(1)).toString().replace('\\', '/')));

[Patch]
entryPath.subpath(2, entryPath.getNameCount()).toString().replace('\\', '/')));

[Demonstration 2]

[Buggy Method]
public List<Workbook> getWorkbooks() {
    Workbook inputWorkBook = null;
    try {
        inputWorkBook = WorkbookFactory.create(new File(filePath));
    } catch (IOException | InvalidFormatException e) {
        System.out.println("========== Failed to process Input Excel From: " + filePath + " ==================");
        e.printStackTrace();
    }
    if (inputWorkBook == null || inputWorkBook.getSheetAt(0) == null || inputWorkBook.getNumberOfSheets() == 0) {
        return Collections.emptyList();
    }
    Sheet inputSheet = inputWorkBook.getSheetAt(0);
    System.out.println("========== Total Number of Row to be processed (with blank rows): " + inputSheet.getPhysicalNumberOfRows() + " ==================");
    Row headerRow = null;
    int totalProcessedRowCount = 0;
    Iterator<Row> rowIterator = inputSheet.iterator();
    if (rowIterator.hasNext()) {
        headerRow = rowIterator.next();
        totalProcessedRowCount++;
    }
    assert headerRow != null;
    int headerCount = findLastNonEmptyColumnIndex(headerRow);
    if (headerCount == 0) {
        return Collections.emptyList();
    }
    List<Workbook> workbooks = new ArrayList<>();
    Workbook workbook = new HSSFWorkbook();
    Sheet splittedInputSheet = workbook.createSheet();
    Row newHeaderRow = splittedInputSheet.createRow(0);
    copyRowValues(workbook, headerRow, newHeaderRow, headerCount);
    int rowCount = 0;
    while (rowIterator.hasNext()) {
        Row row = rowIterator.next();
        if (!isEmpty(row)) {
            Row newRow = splittedInputSheet.createRow(splittedInputSheet.getLastRowNum() + 1);
            copyRowValues(workbook, row, newRow, headerCount);
            totalProcessedRowCount++;
            rowCount++;
        }
        if (rowCount == maxRowPerFile) {
            workbooks.add(workbook);
            workbook = new HSSFWorkbook();
            splittedInputSheet = workbook.createSheet();
            newHeaderRow = splittedInputSheet.createRow(0);
            copyRowValues(workbook, headerRow, newHeaderRow, headerCount);
            rowCount = 0;
        }
    }
    if (workbook.getSheetAt(0).getPhysicalNumberOfRows() > 0) {
        workbooks.add(workbook);
    }
    System.out.println("========== Total Number of Row to be processed (without blank rows): " + totalProcessedRowCount + " ==================");
    return workbooks;
}

[Buggy Hunk]
if (workbook.getSheetAt(0).getPhysicalNumberOfRows() > 0) {

[Patch]
if (workbook.getSheetAt(0).getPhysicalNumberOfRows() > 1) {

[Demonstration 3]

[Buggy Method]
private Stream<JSONObject> workTypes() {
    if (cachedWorkTypes.isEmpty()) {
        JSONParser jsonParser = new JSONParser();
        PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
        try {
            for (Resource resource : resolver.getResources("classpath:worktypes/*.json")) {
                try (Reader reader = new InputStreamReader(resource.getInputStream())) {
                    cachedWorkTypes.add((JSONObject) jsonParser.parse(reader));
                }
            }
        } catch (IOException | ParseException e) {
            LOG.error("Failed to retrieve work types", e);
        }
    }
    return cachedWorkTypes.stream();
}

[Buggy Hunk]
try (Reader reader = new InputStreamReader(resource.getInputStream())) {

[Patch]
try (Reader reader = new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8)) {