Undocumented NPE if Stapler.getCurrent()
called outside an HTTP handling thread
#596
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://github.com/jenkinsci/jenkins/blob/e1a6b190d4d71e95a8e00facd52ce7718909b9e8/core/src/main/java/hudson/model/TopLevelItemDescriptor.java#L146-L175 seems to assume this method can be called safely and return null. (I tried to write an integration test but every
TopLevelItemDescriptor
subclass seems to override this method.) https://github.com/jenkinsci/support-core-plugin/blob/a85622b87b52a0ebaf3ecf97c7a443df546e4242/src/main/java/com/cloudbees/jenkins/support/impl/AboutJenkins.java#L507-L517 notes the poor behavior.