Revert "Jenkins.getInstance() should be non-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.
This commit is contained in:
Stephen Connolly committed 2016-03-08 21:09:28 +00:00
1 parent 074890c093
commit d1dfbd2baf
42 files changed
+78 -99

No files matched your search

+5 -5
View File
@@ -228,7 +228,7 @@ public class Functions {
* @since 1.607
*/
public static boolean isExtensionsAvailable() {
final Jenkins jenkins = Jenkins.getInstanceOrNull();
final Jenkins jenkins = Jenkins.getInstance();
return jenkins != null && jenkins.getInitLevel().compareTo(InitMilestone.EXTENSIONS_AUGMENTED) >= 0
&& !jenkins.isTerminating();
}
@@ -1659,7 +1659,7 @@ public class Functions {
*/
public static List<PageDecorator> getPageDecorators() {
// this method may be called to render start up errors, at which point Hudson doesn't exist yet. see HUDSON-3608
if(Jenkins.getInstanceOrNull()==null) return Collections.emptyList();
if(Jenkins.getInstance()==null) return Collections.emptyList();
return PageDecorator.all();
}
@@ -1681,13 +1681,13 @@ public class Functions {
}
public static String getCrumb(StaplerRequest req) {
Jenkins h = Jenkins.getInstanceOrNull();
Jenkins h = Jenkins.getInstance();
CrumbIssuer issuer = h != null ? h.getCrumbIssuer() : null;
return issuer != null ? issuer.getCrumb(req) : "";
}
public static String getCrumbRequestField() {
Jenkins h = Jenkins.getInstanceOrNull();
Jenkins h = Jenkins.getInstance();
CrumbIssuer issuer = h != null ? h.getCrumbIssuer() : null;
return issuer != null ? issuer.getDescriptor().getCrumbRequestField() : "";
}
@@ -1917,7 +1917,7 @@ public class Functions {
* discovery of Jenkins.
*/
public static void advertiseHeaders(HttpServletResponse rsp) {
Jenkins j = Jenkins.getInstanceOrNull();
Jenkins j = Jenkins.getInstance();
if (j!=null) {
rsp.setHeader("X-Hudson","1.395");
rsp.setHeader("X-Jenkins", Jenkins.VERSION);