[Demonstration 1]

[Buggy Method]
public bool requiresLargefiles(FilePath repo) throws IOException, InterruptedException {
    FilePath requires = repo.child(".hg/requires");
    return requires.exists() && requires.readToString().contains("largefiles");
}

[Buggy Hunk]
public bool requiresLargefiles(FilePath repo) throws IOException, InterruptedException {

[Patch]
public boolean requiresLargefiles(FilePath repo) throws IOException, InterruptedException {

[Demonstration 2]

[Buggy Method]
public Collection<StoredFactoryMetadata> getHistoryFactoryList() {
    ArrayList<StoredFactoryMetadata> result = new ArrayList<>();
    try (Connection connection = connectionSupplier.get()) {
        try (Statement statement = connection.createStatement()) {
            String sql = "SELECT * FROM FACTORY_HISTORY";
            ResultSet resultSet = statement.executeQuery(sql);
            while (resultSet.next()) {
                Blob factoryMetadataBlob = resultSet.getBlob("factoryMetadata");
                StoredFactoryMetadata factoryMetadata = factorySerialisationManager.readStoredFactoryMetadata(new String(factoryMetadataBlob.getBytes(1L, (int) factoryMetadataBlob.length())));
                result.add(factoryMetadata);
            }
        }
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }
    return result;
}

[Buggy Hunk]
while(resultSet.next()){

[Patch]
if(resultSet.next()){

[Demonstration 3]

[Buggy Method]
public static List<String> clearChangedFiles(FilePath workspace) throws IOException, InterruptedException {
    List<FilePath> changedFiles = workspace.list(new FileFileFilter() {

        @Override
        public boolean accept(File pathname) {
            return pathname.isFile() && pathname.getName().contains(ChangedFilenameBuilder.CHANGED_FILENAME_PATTERN);
        }
    });
    for (FilePath changedFile : changedFiles) {
        changedFile.delete();
    }
    return Lists.transform(changedFiles, new Function<FilePath, String>() {

        @Override
        public String apply(FilePath filePath) {
            return filePath.getName();
        }
    });
}

[Buggy Hunk]
public String apply(FilePath filePath) {

[Patch]
public String apply(@Nonnull FilePath filePath) {