mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-10-31 13:35:19 +00:00
Jenkins.getInstance() should be non-null
- It is never too late to do the right thing. - The vast majority of usages of `Jenkins.getInstance()` in core currently assume that its return value is non-null - This commit changes those that are written to correctly check for non-null values will call `Jenkins.getInstanceOrNull()` - We deprecate the `Jenkins.getActiveInstance()` madness - I checked with @kohsuke who said not to bother with a PR and just commit this strongly opinionated change direct to master as a PR will just degrade into a bikeshedding.
This commit is contained in:
1 parent
7597c98a90
commit
bb7c8fcedb
42 files changed
+99
-78
No files matched your search
@@ -1133,7 +1133,7 @@ public final class FilePath implements Serializable {
|
||||
* @since 1.571
|
||||
*/
|
||||
public @CheckForNull Computer toComputer() {
|
||||
Jenkins j = Jenkins.getInstance();
|
||||
Jenkins j = Jenkins.getInstanceOrNull();
|
||||
if (j != null) {
|
||||
for (Computer c : j.getComputers()) {
|
||||
if (getChannel()==c.getChannel()) {
|
||||
|
||||
Reference in new issue
Block a user