[Demonstration 1]

[Buggy Method]
@ReactMethod
public void clearCache(Callback callback) {
    try {
        String fileBasePath = this.getReactApplicationContext().getFilesDir().getAbsolutePath();
        File file = new File(fileBasePath + "/audioCache");
        if (!file.exists()) {
            callback.invoke(true);
            return;
        }
        boolean success = DeleteRecursive(file);
        callback.invoke(success);
    } catch (Exception ex) {
        ex.printStackTrace();
        callback.invoke(false);
    }
}

[Buggy Hunk]
String fileBasePath = this.getReactApplicationContext().getFilesDir().getAbsolutePath();

[Patch]
String fileBasePath = this.getReactApplicationContext().getFilesDir().getCanonicalPath();

[Demonstration 2]

[Buggy Method]
@RequestMapping(value = "delete")
@ResponseBody
public RestResponseBo delete(@RequestParam Integer id, HttpServletRequest request) {
    try {
        AttachVo attach = attachService.selectById(id);
        if (null == attach)
            return RestResponseBo.fail("不存在该附件");
        attachService.deleteById(id);
        new File(attach.getFkey()).delete();
        logService.insertLog(LogActions.DEL_ARTICLE.getAction(), attach.getFkey(), request.getRemoteAddr(), this.getUid(request));
    } catch (Exception e) {
        String msg = "附件删除失败";
        if (e instanceof TipException)
            msg = e.getMessage();
        else
            LOGGER.error(msg, e);
        return RestResponseBo.fail(msg);
    }
    return RestResponseBo.ok();
}

[Buggy Hunk]
new File(attach.getFkey()).delete();

[Patch]
new File(CLASSPATH+attach.getFkey()).delete();

[Demonstration 3]

[Buggy Method]
static void setDirectory(String dir) {
    if (osName.contains("Windows")) {
        userPrefs.put("folderDirectory", dir + "\\");
    } else {
        userPrefs.put("folderDirectory", dir + "/");
    }
    FXController.folderDirectory = userPrefs.get("folderDirectory", null);
}

[Buggy Hunk]
userPrefs.put("folderDirectory", dir + "/");

[Patch]
userPrefs.put("folderDirectory", dir + File.separatorChar);