Skip to content
Commit 8f512603 authored by Daniel Trebbien's avatar Daniel Trebbien Committed by Oleg Nenashev
Browse files

hudson.Util improvements (#3226)

* Organize imports

* Use StandardCharsets

* Delete a redundant cast

* Replace use of _ as an identifier

_ is a keyword in Java 9.

* Use Logger message formatting

* Use fileToPath()

* Switch to using Files.createTempDirectory()

* Document that Util.touch() will truncate an existing file

* Replace an unnecessary use of Throwable.initCause()

* Implement deprecated copyStream() using IOUtils

* Copy to NULL_OUTPUT_STREAM

Also, closing source is moved to a finally block, to guarantee that it
will be closed per the documentation; it was technically possible for
the input stream to not be closed if construction of the MessageDigest,
DigestInputStream, or byte[] buffer failed for some reason (e.g. out of
memory).

* Delete an unnecessary try-with-resources

* Throw an IllegalArgumentException if data has odd length

Previously, a StringIndexOutOfBoundsException would be thrown, which is
less clear.

* Specify expanded POSIX file permissions
parent 46510e2d
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment