Commit Graph
270 Commits
Author SHA1 Message Date
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 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
Daniel Beck 86639c9007 Merge commit '31d7966e3896819a99b31f10e83e864e3805bcbd' into security-master 2018-07-16 11:42:43 +02:00
Wadeck Follonier e0cc790ee7 Address other comments
- also add translation for another creationDate
- and manage correctly the null creation date instead of 0
2018-06-26 17:33:05 +02:00
Wadeck Follonier 0a41e87b66 Address Josh's comments 2018-06-26 14:51:25 +02:00
Wadeck Follonier 5f7c50cd0d [JENKINS-52161] Improve creation-date value determination
- in case of migration we put null instead of now
- improve also the difference in days for the Xxx day(s) ago to take calendar day in difference and not the total duration (<24h = 0 days, which seems wrong in UI)
2018-06-26 13:06:16 +02:00
Jenn Briden 434135ef20 Changed references to "slave" and "slaves" to "agent" and "agents" 2018-05-14 22:04:47 -07:00
Daniel Beck 556d6f7036 Merge commit 'b92db0f04e64cdd7a815bd78a5dd3dd4cd7ead7c' of git://github.com/jenkinsci/jenkins 2018-04-25 23:11:13 +02:00
Jesse Glick d25c0b2c39 Merge branch 'master' into VirtualFile-JENKINS-49635 2018-04-13 12:32:38 -04:00
Daniel Beck bbe96187ab Merge branch 'security-stable-2.107' into security-master 2018-03-29 02:01:34 +02:00
Daniel Trebbien aa799e39ad [JENKINS-49971] Fix a race condition in Util.loadFile() (#3225)
* Fix a race condition in Util.loadFile()

If the file is deleted in between when its existence is checked and the
file is opened for reading, then the method will fail to return an empty
string.

* Switch to using FileUtils.readFileToString()

(cherry picked from commit aaae71af4b)
2018-03-25 20:17:21 +02:00
Jesse Glick c7372cc098 Merge branch 'master' into VirtualFile-JENKINS-49635 2018-03-12 13:56:15 -04:00
Daniel Trebbien aaae71af4b [JENKINS-49971] Fix a race condition in Util.loadFile() (#3225)
* Fix a race condition in Util.loadFile()

If the file is deleted in between when its existence is checked and the
file is opened for reading, then the method will fail to return an empty
string.

* Switch to using FileUtils.readFileToString()
2018-03-08 00:53:53 +01:00
Jesse Glick 23f12fd8f5 Merge branch 'master' into VirtualFile-JENKINS-49635 2018-03-05 10:02:42 -05:00
Daniel Trebbien 8f51260323 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
2018-03-03 13:04:29 +01:00