• D
    hudson.Util improvements (#3226) · 8f512603
    Daniel Trebbien 提交于
    * 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
    8f512603
Util.java 64.9 KB