{"action":"created","comment":{"url":"https://api.github.com/repos/jenkinsci/jenkins/pulls/comments/165814725","pull_request_review_id":93816729,"id":165814725,"diff_hunk":"@@ -0,0 +1,114 @@\n+/*\n+ * The MIT License\n+ *\n+ * Copyright 2018 Daniel Trebbien.\n+ *\n+ * Permission is hereby granted, free of charge, to any person obtaining a copy\n+ * of this software and associated documentation files (the \"Software\"), to deal\n+ * in the Software without restriction, including without limitation the rights\n+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+ * copies of the Software, and to permit persons to whom the Software is\n+ * furnished to do so, subject to the following conditions:\n+ *\n+ * The above copyright notice and this permission notice shall be included in\n+ * all copies or substantial portions of the Software.\n+ *\n+ * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n+ * THE SOFTWARE.\n+ */\n+package jenkins.util.io;\n+\n+import com.google.common.collect.AbstractIterator;\n+\n+import edu.umd.cs.findbugs.annotations.CleanupObligation;\n+import edu.umd.cs.findbugs.annotations.DischargesObligation;\n+\n+import java.io.BufferedReader;\n+import java.io.Closeable;\n+import java.io.IOException;\n+import java.nio.file.Files;\n+import java.nio.file.Path;\n+import java.util.Iterator;\n+\n+import javax.annotation.Nonnull;\n+import javax.annotation.Nullable;\n+\n+/**\n+ * Represents a stream over the lines of a text file.\n+ * <p>\n+ * Although <code>LinesStream</code> implements {@link java.lang.Iterable}, it\n+ * is intended to be first used to initialize a resource in a try-with-resources\n+ * statement and then iterated, as in:\n+ * <pre>\n+ *  try (LinesStream stream = new LinesStream(...)) {\n+ *      for (String line : stream) {\n+ *          ...\n+ *      }\n+ *  }\n+ * </pre>\n+ * This pattern ensures that the underlying file handle is closed properly.\n+ * <p>\n+ * Like {@link java.nio.file.DirectoryStream}, <code>LinesStream</code> supports\n+ * creating at most one <code>Iterator</code>. Invoking {@link #iterator()} to\n+ * obtain a second or subsequent <code>Iterator</code> throws\n+ * <code>IllegalStateException</code>.\n+ *\n+ * @since TODO\n+ */\n+@CleanupObligation\n+public class LinesStream implements Closeable, Iterable<String> {","path":"core/src/main/java/jenkins/util/io/LinesStream.java","position":64,"original_position":64,"commit_id":"b89bebcdfe35ca6d35ee8afa6a6bfefb8dd3ae0d","original_commit_id":"b89bebcdfe35ca6d35ee8afa6a6bfefb8dd3ae0d","user":{"login":"oleg-nenashev","id":3000480,"avatar_url":"https://avatars0.githubusercontent.com/u/3000480?v=4","gravatar_id":"","url":"https://api.github.com/users/oleg-nenashev","html_url":"https://github.com/oleg-nenashev","followers_url":"https://api.github.com/users/oleg-nenashev/followers","following_url":"https://api.github.com/users/oleg-nenashev/following{/other_user}","gists_url":"https://api.github.com/users/oleg-nenashev/gists{/gist_id}","starred_url":"https://api.github.com/users/oleg-nenashev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oleg-nenashev/subscriptions","organizations_url":"https://api.github.com/users/oleg-nenashev/orgs","repos_url":"https://api.github.com/users/oleg-nenashev/repos","events_url":"https://api.github.com/users/oleg-nenashev/events{/privacy}","received_events_url":"https://api.github.com/users/oleg-nenashev/received_events","type":"User","site_admin":false},"body":"Maybe `@Restricted(NoExternalUse.class)`? No strong opinion. Runtimized IOException on read error should be documented if it goes to public API","created_at":"2018-02-03T13:33:28Z","updated_at":"2018-02-03T13:34:13Z","html_url":"https://github.com/jenkinsci/jenkins/pull/3211#discussion_r165814725","pull_request_url":"https://api.github.com/repos/jenkinsci/jenkins/pulls/3211","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/jenkins/pulls/comments/165814725"},"html":{"href":"https://github.com/jenkinsci/jenkins/pull/3211#discussion_r165814725"},"pull_request":{"href":"https://api.github.com/repos/jenkinsci/jenkins/pulls/3211"}}},"pull_request":{"url":"https://api.github.com/repos/jenkinsci/jenkins/pulls/3211","id":160426280,"html_url":"https://github.com/jenkinsci/jenkins/pull/3211","diff_url":"https://github.com/jenkinsci/jenkins/pull/3211.diff","patch_url":"https://github.com/jenkinsci/jenkins/pull/3211.patch","issue_url":"https://api.github.com/repos/jenkinsci/jenkins/issues/3211","number":3211,"state":"open","locked":false,"title":"Refactor TextFile.lines()","user":{"login":"dtrebbien","id":277166,"avatar_url":"https://avatars3.githubusercontent.com/u/277166?v=4","gravatar_id":"","url":"https://api.github.com/users/dtrebbien","html_url":"https://github.com/dtrebbien","followers_url":"https://api.github.com/users/dtrebbien/followers","following_url":"https://api.github.com/users/dtrebbien/following{/other_user}","gists_url":"https://api.github.com/users/dtrebbien/gists{/gist_id}","starred_url":"https://api.github.com/users/dtrebbien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtrebbien/subscriptions","organizations_url":"https://api.github.com/users/dtrebbien/orgs","repos_url":"https://api.github.com/users/dtrebbien/repos","events_url":"https://api.github.com/users/dtrebbien/events{/privacy}","received_events_url":"https://api.github.com/users/dtrebbien/received_events","type":"User","site_admin":false},"body":"Introduces a LinesStream utility class that is responsible for closing\r\nthe underlying file handle.\r\n\r\nSwitches to calling Files.newBufferedReader() instead of wrapping the\r\nInputStream returned by Files.newInputStream() in a BufferedReader of\r\nan InputStreamReader.\r\n\r\nCreates the file reader at the time that lines() is invoked, instead of\r\nat the time that iterator() of the returned Iterable is invoked. This\r\ncan help prevent confusion as to the cause of an exception, whether it's\r\nbecause of a problem opening the file or reading from it.\r\n\r\n<!-- Comment: \r\nIf the issue is not fully described in the ticket, add more information here (justification, pull request links, etc.).\r\n\r\n * We do not require JIRA issues for minor improvements.\r\n * Bugfixes should have a JIRA issue (backporting process).\r\n * Major new features should have a JIRA issue reference.\r\n-->\r\n\r\n### Proposed changelog entries\r\n\r\n* API: TextFile.lines() now can throw `IOException`\r\n\r\n<!-- Comment: \r\nThe changelogs will be integrated by the core maintainers after the merge.  See the changelog examples here: https://jenkins.io/changelog/ -->\r\n\r\n### Submitter checklist\r\n\r\n- [ ] JIRA issue is well described\r\n- [ ] Changelog entry appropriate for the audience affected by the change (users or developer, depending on the change). [Examples](https://github.com/jenkins-infra/jenkins.io/blob/master/content/_data/changelogs/weekly.yml)\r\n      * Use the `Internal: ` prefix if the change has no user-visible impact (API, test frameworks, etc.)\r\n- [ ] Appropriate autotests or explanation to why this change has no tests\r\n- [ ] For dependency updates: links to external changelogs and, if possible, full diffs\r\n\r\n<!-- For new API and extension points: Link to the reference implementation in open-source (or example in Javadoc) -->\r\n\r\n### Desired reviewers\r\n\r\n<!-- Comment:\r\nIf you need an accelerated review process by the community (e.g., for critical bugs), mention @jenkinsci/code-reviewers\r\n-->\r\n","created_at":"2017-12-28T18:30:07Z","updated_at":"2018-02-03T13:34:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3a9ea00d988c011cd1ddf5ad69cc1c494a5bafd6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/jenkinsci/jenkins/pulls/3211/commits","review_comments_url":"https://api.github.com/repos/jenkinsci/jenkins/pulls/3211/comments","review_comment_url":"https://api.github.com/repos/jenkinsci/jenkins/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jenkinsci/jenkins/issues/3211/comments","statuses_url":"https://api.github.com/repos/jenkinsci/jenkins/statuses/b89bebcdfe35ca6d35ee8afa6a6bfefb8dd3ae0d","head":{"label":"dtrebbien:refactor-TextFile-lines","ref":"refactor-TextFile-lines","sha":"b89bebcdfe35ca6d35ee8afa6a6bfefb8dd3ae0d","user":{"login":"dtrebbien","id":277166,"avatar_url":"https://avatars3.githubusercontent.com/u/277166?v=4","gravatar_id":"","url":"https://api.github.com/users/dtrebbien","html_url":"https://github.com/dtrebbien","followers_url":"https://api.github.com/users/dtrebbien/followers","following_url":"https://api.github.com/users/dtrebbien/following{/other_user}","gists_url":"https://api.github.com/users/dtrebbien/gists{/gist_id}","starred_url":"https://api.github.com/users/dtrebbien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtrebbien/subscriptions","organizations_url":"https://api.github.com/users/dtrebbien/orgs","repos_url":"https://api.github.com/users/dtrebbien/repos","events_url":"https://api.github.com/users/dtrebbien/events{/privacy}","received_events_url":"https://api.github.com/users/dtrebbien/received_events","type":"User","site_admin":false},"repo":{"id":115584161,"name":"jenkins","full_name":"dtrebbien/jenkins","owner":{"login":"dtrebbien","id":277166,"avatar_url":"https://avatars3.githubusercontent.com/u/277166?v=4","gravatar_id":"","url":"https://api.github.com/users/dtrebbien","html_url":"https://github.com/dtrebbien","followers_url":"https://api.github.com/users/dtrebbien/followers","following_url":"https://api.github.com/users/dtrebbien/following{/other_user}","gists_url":"https://api.github.com/users/dtrebbien/gists{/gist_id}","starred_url":"https://api.github.com/users/dtrebbien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtrebbien/subscriptions","organizations_url":"https://api.github.com/users/dtrebbien/orgs","repos_url":"https://api.github.com/users/dtrebbien/repos","events_url":"https://api.github.com/users/dtrebbien/events{/privacy}","received_events_url":"https://api.github.com/users/dtrebbien/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dtrebbien/jenkins","description":"My fork of Jenkins","fork":true,"url":"https://api.github.com/repos/dtrebbien/jenkins","forks_url":"https://api.github.com/repos/dtrebbien/jenkins/forks","keys_url":"https://api.github.com/repos/dtrebbien/jenkins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dtrebbien/jenkins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dtrebbien/jenkins/teams","hooks_url":"https://api.github.com/repos/dtrebbien/jenkins/hooks","issue_events_url":"https://api.github.com/repos/dtrebbien/jenkins/issues/events{/number}","events_url":"https://api.github.com/repos/dtrebbien/jenkins/events","assignees_url":"https://api.github.com/repos/dtrebbien/jenkins/assignees{/user}","branches_url":"https://api.github.com/repos/dtrebbien/jenkins/branches{/branch}","tags_url":"https://api.github.com/repos/dtrebbien/jenkins/tags","blobs_url":"https://api.github.com/repos/dtrebbien/jenkins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dtrebbien/jenkins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dtrebbien/jenkins/git/refs{/sha}","trees_url":"https://api.github.com/repos/dtrebbien/jenkins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dtrebbien/jenkins/statuses/{sha}","languages_url":"https://api.github.com/repos/dtrebbien/jenkins/languages","stargazers_url":"https://api.github.com/repos/dtrebbien/jenkins/stargazers","contributors_url":"https://api.github.com/repos/dtrebbien/jenkins/contributors","subscribers_url":"https://api.github.com/repos/dtrebbien/jenkins/subscribers","subscription_url":"https://api.github.com/repos/dtrebbien/jenkins/subscription","commits_url":"https://api.github.com/repos/dtrebbien/jenkins/commits{/sha}","git_commits_url":"https://api.github.com/repos/dtrebbien/jenkins/git/commits{/sha}","comments_url":"https://api.github.com/repos/dtrebbien/jenkins/comments{/number}","issue_comment_url":"https://api.github.com/repos/dtrebbien/jenkins/issues/comments{/number}","contents_url":"https://api.github.com/repos/dtrebbien/jenkins/contents/{+path}","compare_url":"https://api.github.com/repos/dtrebbien/jenkins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dtrebbien/jenkins/merges","archive_url":"https://api.github.com/repos/dtrebbien/jenkins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dtrebbien/jenkins/downloads","issues_url":"https://api.github.com/repos/dtrebbien/jenkins/issues{/number}","pulls_url":"https://api.github.com/repos/dtrebbien/jenkins/pulls{/number}","milestones_url":"https://api.github.com/repos/dtrebbien/jenkins/milestones{/number}","notifications_url":"https://api.github.com/repos/dtrebbien/jenkins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dtrebbien/jenkins/labels{/name}","releases_url":"https://api.github.com/repos/dtrebbien/jenkins/releases{/id}","deployments_url":"https://api.github.com/repos/dtrebbien/jenkins/deployments","created_at":"2017-12-28T04:15:37Z","updated_at":"2017-12-28T04:16:20Z","pushed_at":"2018-01-24T16:46:08Z","git_url":"git://github.com/dtrebbien/jenkins.git","ssh_url":"git@github.com:dtrebbien/jenkins.git","clone_url":"https://github.com/dtrebbien/jenkins.git","svn_url":"https://github.com/dtrebbien/jenkins","homepage":"","size":105815,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jenkinsci:master","ref":"master","sha":"e8c86a374f0892c444719d6c90ef4901276cb029","user":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars0.githubusercontent.com/u/107424?v=4","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"repo":{"id":1103607,"name":"jenkins","full_name":"jenkinsci/jenkins","owner":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars0.githubusercontent.com/u/107424?v=4","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jenkinsci/jenkins","description":"Jenkins automation server","fork":true,"url":"https://api.github.com/repos/jenkinsci/jenkins","forks_url":"https://api.github.com/repos/jenkinsci/jenkins/forks","keys_url":"https://api.github.com/repos/jenkinsci/jenkins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/jenkins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/jenkins/teams","hooks_url":"https://api.github.com/repos/jenkinsci/jenkins/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/jenkins/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/jenkins/events","assignees_url":"https://api.github.com/repos/jenkinsci/jenkins/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/jenkins/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/jenkins/tags","blobs_url":"https://api.github.com/repos/jenkinsci/jenkins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/jenkins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/jenkins/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/jenkins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/jenkins/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/jenkins/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/jenkins/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/jenkins/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/jenkins/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/jenkins/subscription","commits_url":"https://api.github.com/repos/jenkinsci/jenkins/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/jenkins/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/jenkins/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/jenkins/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/jenkins/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/jenkins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/jenkins/merges","archive_url":"https://api.github.com/repos/jenkinsci/jenkins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/jenkins/downloads","issues_url":"https://api.github.com/repos/jenkinsci/jenkins/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/jenkins/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/jenkins/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/jenkins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/jenkins/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/jenkins/releases{/id}","deployments_url":"https://api.github.com/repos/jenkinsci/jenkins/deployments","created_at":"2010-11-22T21:21:23Z","updated_at":"2018-02-03T11:26:27Z","pushed_at":"2018-02-03T12:23:13Z","git_url":"git://github.com/jenkinsci/jenkins.git","ssh_url":"git@github.com:jenkinsci/jenkins.git","clone_url":"https://github.com/jenkinsci/jenkins.git","svn_url":"https://github.com/jenkinsci/jenkins","homepage":"https://jenkins.io/","size":105902,"stargazers_count":9700,"watchers_count":9700,"language":"Java","has_issues":false,"has_projects":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":3828,"mirror_url":null,"archived":false,"open_issues_count":117,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":3828,"open_issues":117,"watchers":9700,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/jenkins/pulls/3211"},"html":{"href":"https://github.com/jenkinsci/jenkins/pull/3211"},"issue":{"href":"https://api.github.com/repos/jenkinsci/jenkins/issues/3211"},"comments":{"href":"https://api.github.com/repos/jenkinsci/jenkins/issues/3211/comments"},"review_comments":{"href":"https://api.github.com/repos/jenkinsci/jenkins/pulls/3211/comments"},"review_comment":{"href":"https://api.github.com/repos/jenkinsci/jenkins/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jenkinsci/jenkins/pulls/3211/commits"},"statuses":{"href":"https://api.github.com/repos/jenkinsci/jenkins/statuses/b89bebcdfe35ca6d35ee8afa6a6bfefb8dd3ae0d"}},"author_association":"NONE"}}
{"actor":{"display_login":"oleg-nenashev"}}