{"action":"created","comment":{"url":"https://api.github.com/repos/bugsnag/bugsnag-android/pulls/comments/183379888","pull_request_review_id":114364923,"id":183379888,"diff_hunk":"@@ -29,31 +33,30 @@\n \n         String path;\n         try {\n-            path = appContext.getCacheDir().getAbsolutePath() + folder;\n+            File baseDir = new File(appContext.getCacheDir().getAbsolutePath(), folder);\n+            path = baseDir.getAbsolutePath();\n+            storageDir = getStorageDir(path, config);\n \n-            File outFile = new File(path);\n-            outFile.mkdirs();\n-            if (!outFile.exists()) {\n+            if (!storageDir.exists()) {\n                 Logger.warn(\"Could not prepare file storage directory\");\n                 path = null;\n             }\n         } catch (Exception exception) {\n             Logger.warn(\"Could not prepare file storage directory\", exception);\n             path = null;\n         }\n-        this.storeDirectory = path;\n+        this.oldDirectory = path;\n     }\n \n     @Nullable\n     String write(@NonNull T streamable) {\n-        if (storeDirectory == null) {\n+        if (storageDir == null) {\n             return null;\n         }\n \n         // Limit number of saved errors to prevent disk space issues\n-        File exceptionDir = new File(storeDirectory);\n-        if (exceptionDir.isDirectory()) {\n-            File[] files = exceptionDir.listFiles();\n+        if (storageDir.isDirectory()) {\n+            File[] files = storageDir.listFiles();","path":"sdk/src/main/java/com/bugsnag/android/FileStore.java","position":57,"original_position":57,"commit_id":"9afb2be7b67874e0986804c8d995e578dc731a83","original_commit_id":"9afb2be7b67874e0986804c8d995e578dc731a83","user":{"login":"fractalwrench","id":11800640,"avatar_url":"https://avatars3.githubusercontent.com/u/11800640?v=4","gravatar_id":"","url":"https://api.github.com/users/fractalwrench","html_url":"https://github.com/fractalwrench","followers_url":"https://api.github.com/users/fractalwrench/followers","following_url":"https://api.github.com/users/fractalwrench/following{/other_user}","gists_url":"https://api.github.com/users/fractalwrench/gists{/gist_id}","starred_url":"https://api.github.com/users/fractalwrench/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fractalwrench/subscriptions","organizations_url":"https://api.github.com/users/fractalwrench/orgs","repos_url":"https://api.github.com/users/fractalwrench/repos","events_url":"https://api.github.com/users/fractalwrench/events{/privacy}","received_events_url":"https://api.github.com/users/fractalwrench/received_events","type":"User","site_admin":false},"body":"This needs fixing as it doesn't take the previous directory into account.","created_at":"2018-04-23T12:43:16Z","updated_at":"2018-04-23T12:43:17Z","html_url":"https://github.com/bugsnag/bugsnag-android/pull/290#discussion_r183379888","pull_request_url":"https://api.github.com/repos/bugsnag/bugsnag-android/pulls/290","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/bugsnag/bugsnag-android/pulls/comments/183379888"},"html":{"href":"https://github.com/bugsnag/bugsnag-android/pull/290#discussion_r183379888"},"pull_request":{"href":"https://api.github.com/repos/bugsnag/bugsnag-android/pulls/290"}}},"pull_request":{"url":"https://api.github.com/repos/bugsnag/bugsnag-android/pulls/290","id":182783943,"html_url":"https://github.com/bugsnag/bugsnag-android/pull/290","diff_url":"https://github.com/bugsnag/bugsnag-android/pull/290.diff","patch_url":"https://github.com/bugsnag/bugsnag-android/pull/290.patch","issue_url":"https://api.github.com/repos/bugsnag/bugsnag-android/issues/290","number":290,"state":"open","locked":false,"title":"Support multi client storage","user":{"login":"fractalwrench","id":11800640,"avatar_url":"https://avatars3.githubusercontent.com/u/11800640?v=4","gravatar_id":"","url":"https://api.github.com/users/fractalwrench","html_url":"https://github.com/fractalwrench","followers_url":"https://api.github.com/users/fractalwrench/followers","following_url":"https://api.github.com/users/fractalwrench/following{/other_user}","gists_url":"https://api.github.com/users/fractalwrench/gists{/gist_id}","starred_url":"https://api.github.com/users/fractalwrench/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fractalwrench/subscriptions","organizations_url":"https://api.github.com/users/fractalwrench/orgs","repos_url":"https://api.github.com/users/fractalwrench/repos","events_url":"https://api.github.com/users/fractalwrench/events{/privacy}","received_events_url":"https://api.github.com/users/fractalwrench/received_events","type":"User","site_admin":false},"body":"Adds support for storage of files on a per-client basis, by using a different directory for each client based on a hash of their configured API key and endpoint.\r\n\r\nThis PR alters the `FileStore` class and its descendants so that new errors/sessions are stored in the appropriate location. Previously cached errors/sessions will still be flushed from disk from the old location - JUnit test coverage is added for this.\r\n\r\nAlso see #286 and #285 ","created_at":"2018-04-19T13:53:14Z","updated_at":"2018-04-23T12:43:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2ac155f9622cff5fa107fa4c5dafdbaa440f241a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/bugsnag/bugsnag-android/pulls/290/commits","review_comments_url":"https://api.github.com/repos/bugsnag/bugsnag-android/pulls/290/comments","review_comment_url":"https://api.github.com/repos/bugsnag/bugsnag-android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bugsnag/bugsnag-android/issues/290/comments","statuses_url":"https://api.github.com/repos/bugsnag/bugsnag-android/statuses/9afb2be7b67874e0986804c8d995e578dc731a83","head":{"label":"bugsnag:multi-client-storage","ref":"multi-client-storage","sha":"9afb2be7b67874e0986804c8d995e578dc731a83","user":{"login":"bugsnag","id":1058895,"avatar_url":"https://avatars2.githubusercontent.com/u/1058895?v=4","gravatar_id":"","url":"https://api.github.com/users/bugsnag","html_url":"https://github.com/bugsnag","followers_url":"https://api.github.com/users/bugsnag/followers","following_url":"https://api.github.com/users/bugsnag/following{/other_user}","gists_url":"https://api.github.com/users/bugsnag/gists{/gist_id}","starred_url":"https://api.github.com/users/bugsnag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bugsnag/subscriptions","organizations_url":"https://api.github.com/users/bugsnag/orgs","repos_url":"https://api.github.com/users/bugsnag/repos","events_url":"https://api.github.com/users/bugsnag/events{/privacy}","received_events_url":"https://api.github.com/users/bugsnag/received_events","type":"Organization","site_admin":false},"repo":{"id":2406783,"name":"bugsnag-android","full_name":"bugsnag/bugsnag-android","owner":{"login":"bugsnag","id":1058895,"avatar_url":"https://avatars2.githubusercontent.com/u/1058895?v=4","gravatar_id":"","url":"https://api.github.com/users/bugsnag","html_url":"https://github.com/bugsnag","followers_url":"https://api.github.com/users/bugsnag/followers","following_url":"https://api.github.com/users/bugsnag/following{/other_user}","gists_url":"https://api.github.com/users/bugsnag/gists{/gist_id}","starred_url":"https://api.github.com/users/bugsnag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bugsnag/subscriptions","organizations_url":"https://api.github.com/users/bugsnag/orgs","repos_url":"https://api.github.com/users/bugsnag/repos","events_url":"https://api.github.com/users/bugsnag/events{/privacy}","received_events_url":"https://api.github.com/users/bugsnag/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bugsnag/bugsnag-android","description":"Bugsnag crash reporting for Android apps","fork":false,"url":"https://api.github.com/repos/bugsnag/bugsnag-android","forks_url":"https://api.github.com/repos/bugsnag/bugsnag-android/forks","keys_url":"https://api.github.com/repos/bugsnag/bugsnag-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bugsnag/bugsnag-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bugsnag/bugsnag-android/teams","hooks_url":"https://api.github.com/repos/bugsnag/bugsnag-android/hooks","issue_events_url":"https://api.github.com/repos/bugsnag/bugsnag-android/issues/events{/number}","events_url":"https://api.github.com/repos/bugsnag/bugsnag-android/events","assignees_url":"https://api.github.com/repos/bugsnag/bugsnag-android/assignees{/user}","branches_url":"https://api.github.com/repos/bugsnag/bugsnag-android/branches{/branch}","tags_url":"https://api.github.com/repos/bugsnag/bugsnag-android/tags","blobs_url":"https://api.github.com/repos/bugsnag/bugsnag-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bugsnag/bugsnag-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bugsnag/bugsnag-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/bugsnag/bugsnag-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bugsnag/bugsnag-android/statuses/{sha}","languages_url":"https://api.github.com/repos/bugsnag/bugsnag-android/languages","stargazers_url":"https://api.github.com/repos/bugsnag/bugsnag-android/stargazers","contributors_url":"https://api.github.com/repos/bugsnag/bugsnag-android/contributors","subscribers_url":"https://api.github.com/repos/bugsnag/bugsnag-android/subscribers","subscription_url":"https://api.github.com/repos/bugsnag/bugsnag-android/subscription","commits_url":"https://api.github.com/repos/bugsnag/bugsnag-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/bugsnag/bugsnag-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/bugsnag/bugsnag-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/bugsnag/bugsnag-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/bugsnag/bugsnag-android/contents/{+path}","compare_url":"https://api.github.com/repos/bugsnag/bugsnag-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bugsnag/bugsnag-android/merges","archive_url":"https://api.github.com/repos/bugsnag/bugsnag-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bugsnag/bugsnag-android/downloads","issues_url":"https://api.github.com/repos/bugsnag/bugsnag-android/issues{/number}","pulls_url":"https://api.github.com/repos/bugsnag/bugsnag-android/pulls{/number}","milestones_url":"https://api.github.com/repos/bugsnag/bugsnag-android/milestones{/number}","notifications_url":"https://api.github.com/repos/bugsnag/bugsnag-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bugsnag/bugsnag-android/labels{/name}","releases_url":"https://api.github.com/repos/bugsnag/bugsnag-android/releases{/id}","deployments_url":"https://api.github.com/repos/bugsnag/bugsnag-android/deployments","created_at":"2011-09-17T21:18:06Z","updated_at":"2018-04-23T09:22:29Z","pushed_at":"2018-04-23T08:36:24Z","git_url":"git://github.com/bugsnag/bugsnag-android.git","ssh_url":"git@github.com:bugsnag/bugsnag-android.git","clone_url":"https://github.com/bugsnag/bugsnag-android.git","svn_url":"https://github.com/bugsnag/bugsnag-android","homepage":"https://www.bugsnag.com/platforms/android/","size":1778,"stargazers_count":716,"watchers_count":716,"language":"Java","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":137,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":137,"open_issues":13,"watchers":716,"default_branch":"master"}},"base":{"label":"bugsnag:multi-client-scenario","ref":"multi-client-scenario","sha":"52c06f64d83fbeaf30ceb38370be279b2d01482c","user":{"login":"bugsnag","id":1058895,"avatar_url":"https://avatars2.githubusercontent.com/u/1058895?v=4","gravatar_id":"","url":"https://api.github.com/users/bugsnag","html_url":"https://github.com/bugsnag","followers_url":"https://api.github.com/users/bugsnag/followers","following_url":"https://api.github.com/users/bugsnag/following{/other_user}","gists_url":"https://api.github.com/users/bugsnag/gists{/gist_id}","starred_url":"https://api.github.com/users/bugsnag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bugsnag/subscriptions","organizations_url":"https://api.github.com/users/bugsnag/orgs","repos_url":"https://api.github.com/users/bugsnag/repos","events_url":"https://api.github.com/users/bugsnag/events{/privacy}","received_events_url":"https://api.github.com/users/bugsnag/received_events","type":"Organization","site_admin":false},"repo":{"id":2406783,"name":"bugsnag-android","full_name":"bugsnag/bugsnag-android","owner":{"login":"bugsnag","id":1058895,"avatar_url":"https://avatars2.githubusercontent.com/u/1058895?v=4","gravatar_id":"","url":"https://api.github.com/users/bugsnag","html_url":"https://github.com/bugsnag","followers_url":"https://api.github.com/users/bugsnag/followers","following_url":"https://api.github.com/users/bugsnag/following{/other_user}","gists_url":"https://api.github.com/users/bugsnag/gists{/gist_id}","starred_url":"https://api.github.com/users/bugsnag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bugsnag/subscriptions","organizations_url":"https://api.github.com/users/bugsnag/orgs","repos_url":"https://api.github.com/users/bugsnag/repos","events_url":"https://api.github.com/users/bugsnag/events{/privacy}","received_events_url":"https://api.github.com/users/bugsnag/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bugsnag/bugsnag-android","description":"Bugsnag crash reporting for Android apps","fork":false,"url":"https://api.github.com/repos/bugsnag/bugsnag-android","forks_url":"https://api.github.com/repos/bugsnag/bugsnag-android/forks","keys_url":"https://api.github.com/repos/bugsnag/bugsnag-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bugsnag/bugsnag-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bugsnag/bugsnag-android/teams","hooks_url":"https://api.github.com/repos/bugsnag/bugsnag-android/hooks","issue_events_url":"https://api.github.com/repos/bugsnag/bugsnag-android/issues/events{/number}","events_url":"https://api.github.com/repos/bugsnag/bugsnag-android/events","assignees_url":"https://api.github.com/repos/bugsnag/bugsnag-android/assignees{/user}","branches_url":"https://api.github.com/repos/bugsnag/bugsnag-android/branches{/branch}","tags_url":"https://api.github.com/repos/bugsnag/bugsnag-android/tags","blobs_url":"https://api.github.com/repos/bugsnag/bugsnag-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bugsnag/bugsnag-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bugsnag/bugsnag-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/bugsnag/bugsnag-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bugsnag/bugsnag-android/statuses/{sha}","languages_url":"https://api.github.com/repos/bugsnag/bugsnag-android/languages","stargazers_url":"https://api.github.com/repos/bugsnag/bugsnag-android/stargazers","contributors_url":"https://api.github.com/repos/bugsnag/bugsnag-android/contributors","subscribers_url":"https://api.github.com/repos/bugsnag/bugsnag-android/subscribers","subscription_url":"https://api.github.com/repos/bugsnag/bugsnag-android/subscription","commits_url":"https://api.github.com/repos/bugsnag/bugsnag-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/bugsnag/bugsnag-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/bugsnag/bugsnag-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/bugsnag/bugsnag-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/bugsnag/bugsnag-android/contents/{+path}","compare_url":"https://api.github.com/repos/bugsnag/bugsnag-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bugsnag/bugsnag-android/merges","archive_url":"https://api.github.com/repos/bugsnag/bugsnag-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bugsnag/bugsnag-android/downloads","issues_url":"https://api.github.com/repos/bugsnag/bugsnag-android/issues{/number}","pulls_url":"https://api.github.com/repos/bugsnag/bugsnag-android/pulls{/number}","milestones_url":"https://api.github.com/repos/bugsnag/bugsnag-android/milestones{/number}","notifications_url":"https://api.github.com/repos/bugsnag/bugsnag-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bugsnag/bugsnag-android/labels{/name}","releases_url":"https://api.github.com/repos/bugsnag/bugsnag-android/releases{/id}","deployments_url":"https://api.github.com/repos/bugsnag/bugsnag-android/deployments","created_at":"2011-09-17T21:18:06Z","updated_at":"2018-04-23T09:22:29Z","pushed_at":"2018-04-23T08:36:24Z","git_url":"git://github.com/bugsnag/bugsnag-android.git","ssh_url":"git@github.com:bugsnag/bugsnag-android.git","clone_url":"https://github.com/bugsnag/bugsnag-android.git","svn_url":"https://github.com/bugsnag/bugsnag-android","homepage":"https://www.bugsnag.com/platforms/android/","size":1778,"stargazers_count":716,"watchers_count":716,"language":"Java","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":137,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":137,"open_issues":13,"watchers":716,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bugsnag/bugsnag-android/pulls/290"},"html":{"href":"https://github.com/bugsnag/bugsnag-android/pull/290"},"issue":{"href":"https://api.github.com/repos/bugsnag/bugsnag-android/issues/290"},"comments":{"href":"https://api.github.com/repos/bugsnag/bugsnag-android/issues/290/comments"},"review_comments":{"href":"https://api.github.com/repos/bugsnag/bugsnag-android/pulls/290/comments"},"review_comment":{"href":"https://api.github.com/repos/bugsnag/bugsnag-android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bugsnag/bugsnag-android/pulls/290/commits"},"statuses":{"href":"https://api.github.com/repos/bugsnag/bugsnag-android/statuses/9afb2be7b67874e0986804c8d995e578dc731a83"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"fractalwrench"}}