This reduces duplication of file deletion strategy code and potentially fixes a regression noted in JENKINS-55448.
Signed-off-by: Matt Sicker <boards@gmail.com>
* JENKINS-13128: Preserve copied file permissions and mtime
This fixes a bug where files copied locally do not preserve file permissions or last modification time.
* Use IO utility methods for exception handling
* Fix invalid path exception propagation
* Revert hudson.Util
* Slave.JnlpJar.getURL did not work in some modes when core had a snapshot dependency on Remoting.
* Starting to implement Channel.Listener.read/write.
* Now obtaining response timing statistics.
* For now, avoiding timestamped snapshots, as it caused problems for #3120 which I have asked for help from @stephenc diagnosing.
* Simplified logging a bit.
* onResponse
* hudson.FilePath$Mkdirs is a lot more readable than hudson.FilePath$13.
* Specific snapshot.
* onJar
* LoggingChannelListener
* remoting.version=3.17
* Making a few test assertions more lenient to adapt to https://github.com/jenkinsci/remoting/pull/247.
* Use "Files.createTempDirectory" to create temp directory instead
See SonarQube critical vulnerability squid:S2976 (tag: owasp-a9)
https://next.sonarqube.com/sonarqube/coding_rules#rule_key=squid%3AS2976
* [JENKINS-48227]
Creating a utility "static Path toPath(File file) throws IOException" method,
which wraps InvalidPathException to IOException so that it will be checked.
- also fixed public static final reference
- fixed broken test cases
- added new test cases for toPath() and createTempDir()
* Revert back to public static int
* adjustments due to merges
* Add posix check to determine if Posix FileAttributes should be included
in call to Files.createTempDirectory()
* Remove reference to private element
* Updated to use explicit imports
* Move an instance of renameTo() to Files.move()
* Replace an instance of File.toURI() with an instance of Path.toUri()
* Replace mkdirs() with Files.createDirectories()
Replace mkdir() with Files.createTempDirectory()
* Undo addition of createTempDirectory() as per review comments
* Return to use of FilePath#mkdirs(File) and instead modify it to use the new API.
* Undo addition of toPath() in a URI conversion as it brings no benefits.
* Replace new uses of toPath() with Util.fileToPath() to pre-handle runtime exceptions
* Remove * import.
move mkdirs() to using FilePath method instead of File method.
* Make IOUtils.mkdirs(File) use Java7 API calls
* Add back accidentally removed imports.
* Fixed use of wildcard import
* Use utility method fileToPath() to handle potential exception thrown
* Use NIO for FilePath#chmod and IOUtils#mode
* Add tests for NIO mode and chmod implementations
* Add test, remove new method, and update JavaDoc
* Provide system property to use native implementations of chmod and mode
* Revert unrelated whitespace modification
* Don't remove exception from throws and put imports in original location
* Fix broken JavaDoc links
* Ignore file type bits (above 0o7777) in Util#modeToPermission
* Use octal for constants and don't include file type bits
* Revert unnecessary changes to TarArchiverTest
* Add assertion that non-permission bits are ignored by chmod
* Use NIO copy with StandardCopyOption.COPY_ATTRIBUTES in copyToWithPermissions where possible
* Catch InvalidPathException and convert it to IOException
* Create utility method for File#toPath and use File#createDirectories after review
* Remove useless calls to toAbsolutePath and getAbsoluteFile
* Fix typos and use octal for constant after review
* Add test for behavior of copyToWithPermission with special bits
mkdirs do remoting call by creating anonymous class.
Remoting on remote side must load outer FilePath class with imports.
FilePath had SystemProperties OnMaster.