[Demonstration 1]

[Buggy Method]
private void initEditPost() {
    restartableFirst(REQUEST_EDIT_POST, () -> service.editPost(teamId, channelId, forEditPost).subscribeOn(Schedulers.io()).observeOn(Schedulers.io()), (chatRxFragment, post1) -> {
        PostRepository.prepareAndAddPost(post1);
        sendIvalidateAdapter();
    }, (chatRxFragment1, throwable) -> {
        Post post = new Post(PostRepository.query(new PostByIdSpecification(forEditPost.getId())).first());
        post.setUpdateAt(updateAt);
        PostRepository.update(post);
        sendIvalidateAdapter();
        throwable.printStackTrace();
        Log.d(TAG, "Error edit post " + throwable.getMessage());
    });
}

[Buggy Hunk]
throwable.printStackTrace();

[Patch]
sendError(throwable.getMessage());

[Demonstration 2]

[Buggy Method]
private void saveAttachment(PreNeedAttachment attachment, ServletContext servletContext) throws IOException, IllegalArgumentException {
    DataSource ds = attachment.getDataHandler().getDataSource();
    File file = null;
    InputStream is = null;
    FileOutputStream os = null;
    try {
        is = ds.getInputStream();
        String cachePath = servletContext.getInitParameter("cache");
        // Check servlet context for invalid characters
        if (cachePath.contains(".."))
            throw new IllegalArgumentException("Servlet context contains invalid characters.  Security may have been compromised.");
        String outputFileName = cachePath + "/" + UUID.randomUUID();
        file = new File(outputFileName);
        os = new FileOutputStream(file);
        copyStream(is, os);
        Long storedFileId = documentStorageSession.addDocument("EOAS", attachment.getSendingName(), outputFileName);
        attachment.setDocStorageId(storedFileId);
        preNeedApplicationService.addAttachment(attachment);
    } catch (IOException e) {
        LOGGER.error(e);
        e.printStackTrace();
        throw new IOException(e.getCause());
    } catch (RuntimeException e) {
        LOGGER.error(e);
        e.printStackTrace();
        throw new IOException(e.getMessage());
    } finally {
        try {
            if (file != null) {
                file.delete();
            }
            if (os != null) {
                os.close();
            }
            if (is != null) {
                is.close();
            }
        } catch (IOException e) {
            LOGGER.error(e);
            e.printStackTrace();
            throw new IOException(e.getMessage());
        }
    }
}

[Buggy Hunk]
private void saveAttachment(PreNeedAttachment attachment, ServletContext servletContext) throws IOException,IllegalArgumentException{

[Patch]
private void saveAttachment(PreNeedAttachment attachment, ServletContext servletContext) throws IOException{

[Demonstration 3]

[Buggy Method]
public static void initChatDialog() {
    if (!phoneAlias.equals("")) {
        try {
            chatInfoList = chatDbService.getChatRecord(phoneAlias, sendPerson, phoneAlias);
            if (chatInfoList != null) {
                personChats.clear();
                for (ChatInfo c : chatInfoList) {
                    PersonChat personChatBegin = new PersonChat();
                    if (c.getSend().equals(phoneAlias)) {
                        personChatBegin.setMeSend(true);
                    } else {
                        personChatBegin.setMeSend(false);
                    }
                    personChatBegin.setId(c.getId());
                    personChatBegin.setChatMessage(c.getMsg());
                    personChatBegin.setName(c.getSend());
                    personChatBegin.setTime(c.getTime());
                    personChats.add(personChatBegin);
                }
                chatMsgHandler.sendEmptyMessage(1);
            }
        } catch (Exception e) {
            Log.i("init", "initChat Error " + e);
        }
    }
}

[Buggy Hunk]
Log.i("init", "initChat Error " + e);

[Patch]
LogUtil.e("init", "initChat Error " + e);