[Demonstration 1]

[Buggy Method]
public List<FtpFile> listFiles() {
    // is a directory
    if (!getPhysicalFile().isDirectory()) {
        return null;
    }
    // directory - return all the files
    File[] files = getPhysicalFile().listFiles();
    if (files == null) {
        return null;
    }
    // make sure the files are returned in order
    Arrays.sort(files, new Comparator<File>() {

        public int compare(File f1, File f2) {
            return f1.getName().compareTo(f2.getName());
        }
    });
    // get the virtual name of the base directory
    String virtualFileStr = getAbsolutePath();
    if (virtualFileStr.charAt(virtualFileStr.length() - 1) != '/') {
        virtualFileStr += '/';
    }
    // now return all the files under the directory
    FtpFile[] virtualFiles = new FtpFile[files.length];
    for (int i = 0; i < files.length; ++i) {
        File fileObj = files[i];
        String fileName = virtualFileStr + fileObj.getPath().substring(getPhysicalFile().getPath().length()).replaceAll("\\\\", "/");
        virtualFiles[i] = new CustomFtpFile(FtpUtils.getName(fileName, getAbsolutePath()), fileObj);
    }
    return Collections.unmodifiableList(Arrays.asList(virtualFiles));
}

[Buggy Hunk]
virtualFiles[i] = new CustomFtpFile(FtpUtils.getName(fileName, getAbsolutePath()), fileObj);

[Patch]
virtualFiles[i] = new CustomFtpFile(fileName, fileObj);

[Demonstration 2]

[Buggy Method]
public Post createPost(Channel channel) throws InterruptedException, ExecutionException {
    String id = newId();
    Post post = new Post();
    post.setChannelId(channel.getId());
    post.setMessage("message_" + id);
    post = checkNoError(client.createPost(post)).readEntity();
    return post;
}

[Buggy Hunk]
public Post createPost(Channel channel) throws InterruptedException, ExecutionException {

[Patch]
public Post createPost(Channel channel) {

[Demonstration 3]

[Buggy Method]
@GET
@Produces(MediaType.APPLICATION_JSON)
public String getTeamNames() {
    List<Team> teams = DataManager.getInstance().getTeams();
    teams.sort(new Comparator<Team>() {

        @Override
        public int compare(Team t1, Team t2) {
            return t1.getName().compareTo(t2.getName());
        }
    });
    Gson gs = GsonUtility.getGson();
    return gs.toJson(teams);
}

[Buggy Hunk]
teams.sort(new Comparator<Team>(){

[Patch]
Collections.sort(teams, new Comparator<Team>(){