{"action":"created","comment":{"url":"https://api.github.com/repos/SonarSource/sonar-java/pulls/comments/225581866","pull_request_review_id":165212569,"id":225581866,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNTU4MTg2Ng==","diff_hunk":"@@ -0,0 +1,117 @@\n+/*\n+ * SonarQube Java\n+ * Copyright (C) 2012-2018 SonarSource SA\n+ * mailto:info AT sonarsource DOT com\n+ *\n+ * This program is free software; you can redistribute it and/or\n+ * modify it under the terms of the GNU Lesser General Public\n+ * License as published by the Free Software Foundation; either\n+ * version 3 of the License, or (at your option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n+ * Lesser General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU Lesser General Public License\n+ * along with this program; if not, write to the Free Software Foundation,\n+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n+ */\n+package org.sonar.java.se.checks;\n+\n+import com.google.common.collect.ImmutableSet;\n+import org.sonar.check.Rule;\n+import org.sonar.java.matcher.MethodMatcher;\n+import org.sonar.java.se.CheckerContext;\n+import org.sonar.java.se.Flow;\n+import org.sonar.java.se.ProgramState;\n+import org.sonar.java.se.constraint.BooleanConstraint;\n+import org.sonar.java.se.constraint.Constraint;\n+import org.sonar.plugins.java.api.JavaFileScannerContext;\n+import org.sonar.plugins.java.api.tree.IdentifierTree;\n+import org.sonar.plugins.java.api.tree.MemberSelectExpressionTree;\n+import org.sonar.plugins.java.api.tree.MethodInvocationTree;\n+import org.sonar.plugins.java.api.tree.NewClassTree;\n+import org.sonar.plugins.java.api.tree.Tree;\n+\n+@Rule(key = \"S2689\")\n+public class ObjectOutputStreamCheck extends SECheck {\n+\n+  private static final MethodMatcher FILES_NEW_OUTPUT_STREAM = MethodMatcher.create()\n+    .typeDefinition(\"java.nio.file.Files\")\n+    .name(\"newOutputStream\")\n+    .withAnyParameters();\n+\n+  private static class FileOutputStreamAppendConstraint implements Constraint {\n+    private final Tree node;\n+\n+    FileOutputStreamAppendConstraint(Tree node) {\n+      this.node = node;\n+    }\n+  }\n+\n+  @Override\n+  public ProgramState checkPostStatement(CheckerContext context, Tree syntaxNode) {\n+    ProgramState programState = context.getState();\n+    switch (syntaxNode.kind()) {","path":"java-frontend/src/main/java/org/sonar/java/se/checks/ObjectOutputStreamCheck.java","position":56,"original_position":56,"commit_id":"095fe94400537eef10354d9e8005b3076e84ad5e","original_commit_id":"095fe94400537eef10354d9e8005b3076e84ad5e","user":{"login":"sonarsource-next[bot]","id":39046940,"node_id":"MDM6Qm90MzkwNDY5NDA=","avatar_url":"https://avatars1.githubusercontent.com/in/11855?v=4","gravatar_id":"","url":"https://api.github.com/users/sonarsource-next%5Bbot%5D","html_url":"https://github.com/apps/sonarsource-next","followers_url":"https://api.github.com/users/sonarsource-next%5Bbot%5D/followers","following_url":"https://api.github.com/users/sonarsource-next%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/sonarsource-next%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/sonarsource-next%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sonarsource-next%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/sonarsource-next%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/sonarsource-next%5Bbot%5D/repos","events_url":"https://api.github.com/users/sonarsource-next%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/sonarsource-next%5Bbot%5D/received_events","type":"Bot","site_admin":false},"body":"![Code Smell](https://sonarsource.github.io/sonar-github/code_smell.png 'Code Smell') Code Smell: Complete cases by adding the missing enum constants or add a default case to this switch. ([squid:SwitchLastCaseIsDefaultCheck](https://next.sonarqube.com/sonarqube/coding_rules#rule_key=squid%3ASwitchLastCaseIsDefaultCheck))\n\n[See it in SonarQube](https://next.sonarqube.com/sonarqube/project/issues?id=org.sonarsource.java%3Ajava&pullRequest=2237&issues=AWZ9ahep5nEuavf6NJG2&open=AWZ9ahep5nEuavf6NJG2)\n\n[ISSUE_KEY]: AWZ9ahep5nEuavf6NJG2","created_at":"2018-10-16T15:06:40Z","updated_at":"2018-10-16T15:06:41Z","html_url":"https://github.com/SonarSource/sonar-java/pull/2237#discussion_r225581866","pull_request_url":"https://api.github.com/repos/SonarSource/sonar-java/pulls/2237","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/SonarSource/sonar-java/pulls/comments/225581866"},"html":{"href":"https://github.com/SonarSource/sonar-java/pull/2237#discussion_r225581866"},"pull_request":{"href":"https://api.github.com/repos/SonarSource/sonar-java/pulls/2237"}}},"pull_request":{"url":"https://api.github.com/repos/SonarSource/sonar-java/pulls/2237","id":223153701,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIzMTUzNzAx","html_url":"https://github.com/SonarSource/sonar-java/pull/2237","diff_url":"https://github.com/SonarSource/sonar-java/pull/2237.diff","patch_url":"https://github.com/SonarSource/sonar-java/pull/2237.patch","issue_url":"https://api.github.com/repos/SonarSource/sonar-java/issues/2237","number":2237,"state":"open","locked":false,"title":"SONARJAVA-2885 Rule S2689: Files opened in append mode should not be used with ObjectOutputStream","user":{"login":"mpaladin","id":456050,"node_id":"MDQ6VXNlcjQ1NjA1MA==","avatar_url":"https://avatars2.githubusercontent.com/u/456050?v=4","gravatar_id":"","url":"https://api.github.com/users/mpaladin","html_url":"https://github.com/mpaladin","followers_url":"https://api.github.com/users/mpaladin/followers","following_url":"https://api.github.com/users/mpaladin/following{/other_user}","gists_url":"https://api.github.com/users/mpaladin/gists{/gist_id}","starred_url":"https://api.github.com/users/mpaladin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpaladin/subscriptions","organizations_url":"https://api.github.com/users/mpaladin/orgs","repos_url":"https://api.github.com/users/mpaladin/repos","events_url":"https://api.github.com/users/mpaladin/events{/privacy}","received_events_url":"https://api.github.com/users/mpaladin/received_events","type":"User","site_admin":false},"body":null,"created_at":"2018-10-16T08:13:43Z","updated_at":"2018-10-16T15:06:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4a5b854b48251b32de5ccec09befc4a75b08037a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/SonarSource/sonar-java/pulls/2237/commits","review_comments_url":"https://api.github.com/repos/SonarSource/sonar-java/pulls/2237/comments","review_comment_url":"https://api.github.com/repos/SonarSource/sonar-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SonarSource/sonar-java/issues/2237/comments","statuses_url":"https://api.github.com/repos/SonarSource/sonar-java/statuses/095fe94400537eef10354d9e8005b3076e84ad5e","head":{"label":"SonarSource:SONARJAVA-2885","ref":"SONARJAVA-2885","sha":"095fe94400537eef10354d9e8005b3076e84ad5e","user":{"login":"SonarSource","id":545988,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0NTk4OA==","avatar_url":"https://avatars0.githubusercontent.com/u/545988?v=4","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"repo":{"id":5674787,"node_id":"MDEwOlJlcG9zaXRvcnk1Njc0Nzg3","name":"sonar-java","full_name":"SonarSource/sonar-java","private":false,"owner":{"login":"SonarSource","id":545988,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0NTk4OA==","avatar_url":"https://avatars0.githubusercontent.com/u/545988?v=4","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/SonarSource/sonar-java","description":":coffee: SonarJava : Java static analyzer for SonarQube & SonarLint","fork":false,"url":"https://api.github.com/repos/SonarSource/sonar-java","forks_url":"https://api.github.com/repos/SonarSource/sonar-java/forks","keys_url":"https://api.github.com/repos/SonarSource/sonar-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SonarSource/sonar-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SonarSource/sonar-java/teams","hooks_url":"https://api.github.com/repos/SonarSource/sonar-java/hooks","issue_events_url":"https://api.github.com/repos/SonarSource/sonar-java/issues/events{/number}","events_url":"https://api.github.com/repos/SonarSource/sonar-java/events","assignees_url":"https://api.github.com/repos/SonarSource/sonar-java/assignees{/user}","branches_url":"https://api.github.com/repos/SonarSource/sonar-java/branches{/branch}","tags_url":"https://api.github.com/repos/SonarSource/sonar-java/tags","blobs_url":"https://api.github.com/repos/SonarSource/sonar-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SonarSource/sonar-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SonarSource/sonar-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/SonarSource/sonar-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SonarSource/sonar-java/statuses/{sha}","languages_url":"https://api.github.com/repos/SonarSource/sonar-java/languages","stargazers_url":"https://api.github.com/repos/SonarSource/sonar-java/stargazers","contributors_url":"https://api.github.com/repos/SonarSource/sonar-java/contributors","subscribers_url":"https://api.github.com/repos/SonarSource/sonar-java/subscribers","subscription_url":"https://api.github.com/repos/SonarSource/sonar-java/subscription","commits_url":"https://api.github.com/repos/SonarSource/sonar-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/SonarSource/sonar-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/SonarSource/sonar-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/SonarSource/sonar-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/SonarSource/sonar-java/contents/{+path}","compare_url":"https://api.github.com/repos/SonarSource/sonar-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SonarSource/sonar-java/merges","archive_url":"https://api.github.com/repos/SonarSource/sonar-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SonarSource/sonar-java/downloads","issues_url":"https://api.github.com/repos/SonarSource/sonar-java/issues{/number}","pulls_url":"https://api.github.com/repos/SonarSource/sonar-java/pulls{/number}","milestones_url":"https://api.github.com/repos/SonarSource/sonar-java/milestones{/number}","notifications_url":"https://api.github.com/repos/SonarSource/sonar-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SonarSource/sonar-java/labels{/name}","releases_url":"https://api.github.com/repos/SonarSource/sonar-java/releases{/id}","deployments_url":"https://api.github.com/repos/SonarSource/sonar-java/deployments","created_at":"2012-09-04T15:53:13Z","updated_at":"2018-10-16T13:21:51Z","pushed_at":"2018-10-16T14:56:34Z","git_url":"git://github.com/SonarSource/sonar-java.git","ssh_url":"git@github.com:SonarSource/sonar-java.git","clone_url":"https://github.com/SonarSource/sonar-java.git","svn_url":"https://github.com/SonarSource/sonar-java","homepage":"","size":39486,"stargazers_count":392,"watchers_count":392,"language":"Java","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":280,"mirror_url":null,"archived":false,"open_issues_count":8,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":280,"open_issues":8,"watchers":392,"default_branch":"master"}},"base":{"label":"SonarSource:master","ref":"master","sha":"481cb9d80c21fb422f7e42e41443f7ad1ad82c64","user":{"login":"SonarSource","id":545988,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0NTk4OA==","avatar_url":"https://avatars0.githubusercontent.com/u/545988?v=4","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"repo":{"id":5674787,"node_id":"MDEwOlJlcG9zaXRvcnk1Njc0Nzg3","name":"sonar-java","full_name":"SonarSource/sonar-java","private":false,"owner":{"login":"SonarSource","id":545988,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0NTk4OA==","avatar_url":"https://avatars0.githubusercontent.com/u/545988?v=4","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/SonarSource/sonar-java","description":":coffee: SonarJava : Java static analyzer for SonarQube & SonarLint","fork":false,"url":"https://api.github.com/repos/SonarSource/sonar-java","forks_url":"https://api.github.com/repos/SonarSource/sonar-java/forks","keys_url":"https://api.github.com/repos/SonarSource/sonar-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SonarSource/sonar-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SonarSource/sonar-java/teams","hooks_url":"https://api.github.com/repos/SonarSource/sonar-java/hooks","issue_events_url":"https://api.github.com/repos/SonarSource/sonar-java/issues/events{/number}","events_url":"https://api.github.com/repos/SonarSource/sonar-java/events","assignees_url":"https://api.github.com/repos/SonarSource/sonar-java/assignees{/user}","branches_url":"https://api.github.com/repos/SonarSource/sonar-java/branches{/branch}","tags_url":"https://api.github.com/repos/SonarSource/sonar-java/tags","blobs_url":"https://api.github.com/repos/SonarSource/sonar-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SonarSource/sonar-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SonarSource/sonar-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/SonarSource/sonar-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SonarSource/sonar-java/statuses/{sha}","languages_url":"https://api.github.com/repos/SonarSource/sonar-java/languages","stargazers_url":"https://api.github.com/repos/SonarSource/sonar-java/stargazers","contributors_url":"https://api.github.com/repos/SonarSource/sonar-java/contributors","subscribers_url":"https://api.github.com/repos/SonarSource/sonar-java/subscribers","subscription_url":"https://api.github.com/repos/SonarSource/sonar-java/subscription","commits_url":"https://api.github.com/repos/SonarSource/sonar-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/SonarSource/sonar-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/SonarSource/sonar-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/SonarSource/sonar-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/SonarSource/sonar-java/contents/{+path}","compare_url":"https://api.github.com/repos/SonarSource/sonar-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SonarSource/sonar-java/merges","archive_url":"https://api.github.com/repos/SonarSource/sonar-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SonarSource/sonar-java/downloads","issues_url":"https://api.github.com/repos/SonarSource/sonar-java/issues{/number}","pulls_url":"https://api.github.com/repos/SonarSource/sonar-java/pulls{/number}","milestones_url":"https://api.github.com/repos/SonarSource/sonar-java/milestones{/number}","notifications_url":"https://api.github.com/repos/SonarSource/sonar-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SonarSource/sonar-java/labels{/name}","releases_url":"https://api.github.com/repos/SonarSource/sonar-java/releases{/id}","deployments_url":"https://api.github.com/repos/SonarSource/sonar-java/deployments","created_at":"2012-09-04T15:53:13Z","updated_at":"2018-10-16T13:21:51Z","pushed_at":"2018-10-16T14:56:34Z","git_url":"git://github.com/SonarSource/sonar-java.git","ssh_url":"git@github.com:SonarSource/sonar-java.git","clone_url":"https://github.com/SonarSource/sonar-java.git","svn_url":"https://github.com/SonarSource/sonar-java","homepage":"","size":39486,"stargazers_count":392,"watchers_count":392,"language":"Java","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":280,"mirror_url":null,"archived":false,"open_issues_count":8,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":280,"open_issues":8,"watchers":392,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SonarSource/sonar-java/pulls/2237"},"html":{"href":"https://github.com/SonarSource/sonar-java/pull/2237"},"issue":{"href":"https://api.github.com/repos/SonarSource/sonar-java/issues/2237"},"comments":{"href":"https://api.github.com/repos/SonarSource/sonar-java/issues/2237/comments"},"review_comments":{"href":"https://api.github.com/repos/SonarSource/sonar-java/pulls/2237/comments"},"review_comment":{"href":"https://api.github.com/repos/SonarSource/sonar-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SonarSource/sonar-java/pulls/2237/commits"},"statuses":{"href":"https://api.github.com/repos/SonarSource/sonar-java/statuses/095fe94400537eef10354d9e8005b3076e84ad5e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sonarsource-next"}}