-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Switch to calling Files.newBufferedReader #3210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
These changes were suggested by Extra Hints for NetBeans IDE: http://plugins.netbeans.org/plugin/73447/
| StringBuilder str = new StringBuilder((int)logfile.length()); | ||
|
|
||
| try (BufferedReader r = new BufferedReader(new InputStreamReader(Files.newInputStream(logfile.toPath()), charset))) { | ||
| try (BufferedReader r = Files.newBufferedReader(logfile.toPath(), charset)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nice to use Util.fileToPath to avoid Runtime exceptions. But it can be done in a separate PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created PR #3219 to use fileToPath().
| File queueFile = getQueueFile(); | ||
| if (queueFile.exists()) { | ||
| try (BufferedReader in = new BufferedReader(new InputStreamReader(Files.newInputStream(queueFile.toPath())))) { | ||
| try (BufferedReader in = Files.newBufferedReader(queueFile.toPath(), Charset.defaultCharset())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why we're not using UTF-8 here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dunno. I am fine with fixing it in a separate PR. So far I think that all admins running Jenkins with non-UTF-8 just like to live dangerously, so I just wish them good luck
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created PR #3224 to switch to UTF-8.
|
Thanks @dtrebbien ! |
* Use fileToPath() This is a follow-up to PR 3210 on GitHub. See: #3210 (comment) * Switch two File.toPath() calls to Util.fileToPath() * Delete an unused import
These changes were suggested by Extra Hints for NetBeans IDE:
http://plugins.netbeans.org/plugin/73447/
This is somewhat related to JENKINS-42934.
Proposed changelog entries
None required
Submitter checklist
* Use the
Internal:prefix if the change has no user-visible impact (API, test frameworks, etc.)Desired reviewers