Commit Graph
283 Commits
Author SHA1 Message Date
James Nord bdcb2fb222 Merge remote-tracking branch 'origin/master' into kill-jsr-305 2020-03-30 12:40:44 +01:00
Tim Jacomb 6572cfe4b4 Merge pull request #3941 from jsoref/JENKINS-56643
[JENKINS-56643] Util.createSymlink: prefer Files.move(..., ATOMIC_MOVE)
2020-03-28 09:08:04 +00:00
James Nord 1f946961b9 s/javax.annotation.CheckForNull/edu.umd.cs.findbugs.annotations.CheckForNull/g 2020-03-26 16:12:35 +00:00
James Nord 819f80b12f s/javax.annotation.Nonnull/edu.umd.cs.findbugs.annotations.NonNull/g 2020-03-26 11:14:41 +00:00
James Nord a7fcc8e447 s/javax.annotation.Nullable/edu.umd.cs.findbugs.annotations.Nullable/g 2020-03-26 11:11:22 +00:00
Jeff Thompson bf9ee2ecf4 Address review comments. 2020-01-23 14:59:51 -07:00
Jeff Thompson 348a26f77e Narrow the suppression.
And add TODO connected with JENKINS tickets for relevant issues.
2020-01-23 14:59:51 -07:00
Jeff Thompson c76ee59810 Add findsecbugs plugin to spotbugs.
And suppress existing warnings. We should clean some of them up, but that's for different PRs.
2020-01-23 14:53:53 -07:00
Stefan Spieker 2fbc94bb87 set spotbugs ICAST_IDIV_CAST_TO_DOUBLE to ignore, because precision loss is intended 2019-12-31 10:50:09 +01:00
James Nord 7228af5bb1 [JENKINS-60351] - Make it possible to disable multiple deletion attempts by setting hudson.Util.maxFileDeletionRetries to zero (#4382)
* [JENKINS-60351] It should be possible to disable a retry of the
PathRemover

This does not address the issues that the comments and code in
hudons.Util are inconsistent if they are for retries or total number of
attempts (they are currently total number of attempts)

* [JENKINS-60351] Make the code conform to the documentation

maxRetries should control the number of retries not the number of
attempts.

* rename field from DELETION_MAX to DELETION_RETRIES
2019-12-20 11:07:33 +01:00
Basil Crow 861855953b Replace <code>…</code> with {@code …} 2019-10-19 14:02:59 -07:00
Raihaan Shouhell e5166f7f8d Foreach loops 2019-10-01 13:49:43 +08:00
jesse-houghton d763b4cb11 Added missing null check and associated test (#4204) 2019-09-20 09:36:18 +02:00
Jesse Glick ebd12e727e Deprecating useless Util.getPastTimeString. 2019-08-26 14:15:20 -04:00
Alex Earl f982d84a07 Fix JENKINS-23349 (#4152)
This fixes the issue when the project name
includes a character that can't be encoded
directly in UTF-8, e.g., surrogate pairs.
2019-08-17 13:10:56 +02:00
Josh Soref 4213391a57 [JENKINS-56643] Util.createSymlink: prefer Files.move(..., StandardCopyOption.ATOMIC_MOVE)
Atomic moves mean that there is no time point during which the symlink
will not exist.

Otherwise, if there is a user trying to access the symlink and there is
a process trying to update the symlink, there will be a window during
which there is no symlink. When that happens, builds can randomly fail.

Implementation:
Introduce a private createSymlinkAtomic which will atomically create a
symlink in the right place and return true, or return false leaving no
changes to the file system. It does not throw exceptions.

When it fails, the previous code is used instead.

Changes to the existing code are designed to slightly clarify what
objects are and reuse objects instead of creating them multiple times.
2019-03-20 16:26:03 -04:00
Josh Soref 003e525b79 Java can infer types for <> 2019-02-21 00:33:38 -05:00
Josh Soref 11f301b5ee StringBuilder.append() supports slicing 2019-02-21 00:23:53 -05:00
Josh Soref 264980c707 Java 7: omit explit type in favor of <> 2019-02-20 21:51:03 -05:00
Josh Soref 22b2720036 Java 5: foreach 2019-02-20 21:35:37 -05:00
Josh Soref 893e5c0891 Remove unused imports 2019-02-20 20:55:26 -05:00
Josh Soref 7f85e0d372 Rely on auto unboxing 2019-02-19 23:26:54 -05:00
Oleg Nenashev a026f89ecf Merge pull request #3456 from jennbriden/master
Replacing text references of "slave" with "agent"
2019-01-29 09:53:40 +01:00
Jeff Thompson bf3f0fbf7e Merge pull request #3841 from jvz/util-delete-regression
[JENKINS-55448] Util delete regression
2019-01-18 16:24:19 +00:00
Matt Sicker 94765e1a6f Merge commit '183ca1f95ebc44318194ff53887b876e47d92d34' into security-master 2019-01-15 10:25:50 -06:00
Baptiste Mathus 7796b32023 Revert "[JENKINS-55016] Fix flakiness in UtilTest" 2019-01-14 16:42:08 +01:00
Wadeck Follonier 3210ff5774 Merge commit '6d2eb679a6fccc53d32708cc23c5927201953248' into security-master 2019-01-14 14:08:51 +01:00
Matt Sicker a489cc4ee7 Move Windows util code into test sources
Signed-off-by: Matt Sicker <boards@gmail.com>
2019-01-11 15:35:02 -06:00
Matt Sicker b747845f16 Fix Windows command line argument quoting in createJunction
Signed-off-by: Matt Sicker <boards@gmail.com>
2019-01-11 15:05:50 -06:00
Francisco Fernándezandjvz db59263a15 Fix typo in link
Co-Authored-By: jvz <boards@gmail.com>
2019-01-11 11:27:03 -06:00
Matt Sicker c35f3ba75c Add more tests for JENKINS-55448
This also refactors some test calls to mklink into a package-private Util method due to additional tests needing to create junction points.

Signed-off-by: Matt Sicker <boards@gmail.com>
2019-01-11 10:35:57 -06:00
Matt Sicker 84b1193378 Use explicit functional interface for path checking
Signed-off-by: Matt Sicker <boards@gmail.com>
2019-01-10 14:10:32 -06:00
Matt Sicker 88b515d4bf Revert Util.isSymlink behavior
The simplified form that this replaces has an issue where a file contained somewhere inside a symbolic link is also considered a symbolic link on Windows.

Signed-off-by: Matt Sicker <boards@gmail.com>
2019-01-10 13:54:14 -06:00
Matt Sicker 59880c2fcd Add path filter support to PathRemover
This allows for simplifying FilePath to use PathRemover rather than duplicating logic.

Signed-off-by: Matt Sicker <boards@gmail.com>
2019-01-10 13:40:17 -06:00
Baptiste Mathus 835cd9c6bc Update '@since TODO' using the newly introduced tool 2019-01-08 22:56:31 +01:00
Jeff Thompson 85cc922e85 Merge branch 'security-stable-2.138' into security-stable-2.150 2019-01-03 10:05:19 -07:00
Jeff Thompson 18b40501ac Merge branch 'security-stable-2.121' into security-stable-2.138 2019-01-03 10:03:43 -07:00
Jeff Thompson 0916e5bd3c Merge branch 'security-stable-2.107' into security-stable-2.121 2019-01-03 09:55:20 -07:00
Wadeck Follonier 8c490d14c4 [SECURITY-901] 2019-01-03 09:03:00 -07:00
Matt Sicker c453b9228f Update Util.isSymlink commentary
Signed-off-by: Matt Sicker <boards@gmail.com>
2018-12-21 09:18:35 -06:00
Matt Sicker cc809df4c2 Use Files.isSymbolicLink on non-Windows platforms
Signed-off-by: Matt Sicker <boards@gmail.com>
2018-12-17 15:47:18 -06:00
Matt Sicker 1b23a9e119 Fix symlink check logic to support junctions again
Signed-off-by: Matt Sicker <boards@gmail.com>
2018-12-17 15:18:17 -06:00
Matt Sicker 2e8197a2c7 Complete refactoring of Util.delete methods
This removes duplicated tests from UtilTest that were added in PathRemoverTest. This also ports the sleep/gc strategy for use by default to preserve backward compatibility.

Signed-off-by: Matt Sicker <boards@gmail.com>
2018-12-14 10:33:18 -06:00
Sam Van Oort e0ed9a86e0 Micro-optimizations to Plugin data to reduce minimum memory for Jenkins (#3654)
* Reduce memory footprint for the plugin info by presizing hashmaps to reduce waste for small maps and interning commonly duplicated plugin strings

* Replace duplicated empty string arrays with the one in MemoryReductionUtil

* Fix interning where strings are null

* Fix to deal with the fact that we directly mutate dependency fields for UpdateSite, sigh

* Reduce starting HashMap size for some hashmaps likely to be empty or tiny

* Cleanup per review comments

* Trim some extra waste out of the UpdateSite warnings

* Fix count of optional dependencies

* Move predicates for dependency matching to top-level static final field so they are not duplicated
2018-10-06 12:49:07 +02:00
Oleg Nenashev f120484f84 Amend the Util#fixNull() Javadoc 2018-10-02 10:05:48 +02:00
Olivier Truong 149fd9b608 fix javadoc following PR comments 2018-10-01 23:14:00 +02:00
Olivier Truong 8a3bbdda2f [JENKINS-53847] Improve JavaDoc for Util.fixNull 2018-10-01 22:04:01 +02:00
Oleg Nenashev beadc5946f Util#fixNull: Address Javadoc comments and add annotations 2018-09-30 12:37:53 +02:00
Nicolas De Loof 179d597679 introduce hudson.Util#fixNull(value, defaultValue)
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2018-09-28 13:59:14 +02:00
Oleg Nenashev ba08ebc97a Refactoring: Cleanup <tt> tags from the Jenkins core Javadoc 2018-09-21 17:47:11 -07:00