- Code that is running from a plugin and on the master's JVM is guaranteed to never get null from this method (any cases where you do get null are bugs in core)
- Code that is running from a plugin and on a remote JVM should never be allowed to load the Jenkins class in their classloader, so should never use Jenkins.getInstance()... we are annotating the method with @Nullable so that such code can have some evolution time
- Code that is running in core and on one of two special paths should use the Jenkins.getInstanceOrNull() method so that the UI can be presented to users before the singleton has been instantiated / after the singleton has been destroyed
- The remaining 95% of uses in core (and 100% of uses in plugins) can safely assume that the instance is never null
This reverts commit bb7c8fcedb.
Closes#2090, I'll redo this as a PR... though if that PR is subject to multiple rounds of review before being merged then I will take that of evidence of the exact problem that committing directly was supposed to resolve... namely exponentially multiplying the effort required to make actual improvements to the code base.
- 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.
Previously, when the 2nd `e.click()` is called, the page has already transitioned to another page, so the anchor objects have become invalid.
HtmlUnit somehow still manages to follow a link, except when there's some JavaScript attached to the onclick() handler it's going to execute in a strange environment. Some management link requires a POST, and that was done via JavaScript. So that broke the test.
Re-factored all existed CLI code to follow the new proposed scheme for
raising an exception if issue occurs, handling and reporting it.
Unified CLIRegisterer as well.
Fixed unit tests to follow the new scheme.
This change adds code to check that the user isn't attempting to rename
an existing node with the name of another existing node. Previous to
this change, such rename operations would succeed and would corrupt node
configuration data.
(cherry picked from commit 16d6429c58)
Now that the item list is obtained lock-free the cache is no longer needed.
Besides, the cache could be returning invalid results for requests with different authorization to the one that cached the result (in any case this invalid result is transient).
This change adds code to check that the user isn't attempting to rename
an existing node with the name of another existing node. Previous to
this change, such rename operations would succeed and would corrupt node
configuration data.