提交 7414c3ed 编写于 作者: M mindless

[FIXED HUDSON-6348] avoid NPE in log from Functions.getCrumb when hudson

start fails and error page is being shown.
Also fix message on NoHomeDir error page to show dir instead of {0}


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@33085 71c3de6d-444a-0410-be80-ed276b4c234a
上级 1b8a8dad
...@@ -43,7 +43,6 @@ import hudson.model.ParameterDefinition.ParameterDescriptor; ...@@ -43,7 +43,6 @@ import hudson.model.ParameterDefinition.ParameterDescriptor;
import hudson.model.Project; import hudson.model.Project;
import hudson.model.Run; import hudson.model.Run;
import hudson.model.TopLevelItem; import hudson.model.TopLevelItem;
import hudson.model.User;
import hudson.model.View; import hudson.model.View;
import hudson.model.JDK; import hudson.model.JDK;
import hudson.search.SearchableModelObject; import hudson.search.SearchableModelObject;
...@@ -1178,23 +1177,17 @@ public class Functions { ...@@ -1178,23 +1177,17 @@ public class Functions {
public static List<Descriptor<CrumbIssuer>> getCrumbIssuerDescriptors() { public static List<Descriptor<CrumbIssuer>> getCrumbIssuerDescriptors() {
return CrumbIssuer.all(); return CrumbIssuer.all();
} }
public static String getCrumb(StaplerRequest req) { public static String getCrumb(StaplerRequest req) {
CrumbIssuer issuer = Hudson.getInstance().getCrumbIssuer(); Hudson h = Hudson.getInstance();
if (issuer != null) { CrumbIssuer issuer = h != null ? h.getCrumbIssuer() : null;
return issuer.getCrumb(req); return issuer != null ? issuer.getCrumb(req) : "";
}
return "";
} }
public static String getCrumbRequestField() { public static String getCrumbRequestField() {
CrumbIssuer issuer = Hudson.getInstance().getCrumbIssuer(); Hudson h = Hudson.getInstance();
if (issuer != null) { CrumbIssuer issuer = h != null ? h.getCrumbIssuer() : null;
return issuer.getDescriptor().getCrumbRequestField(); return issuer != null ? issuer.getDescriptor().getCrumbRequestField() : "";
}
return "";
} }
public static Date getCurrentTime() { public static Date getCurrentTime() {
......
# The MIT License # The MIT License
# #
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe # Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
...@@ -21,11 +21,10 @@ ...@@ -21,11 +21,10 @@
# THE SOFTWARE. # THE SOFTWARE.
errorMessage.1=\ errorMessage.1=\
Unable to create the home directory '{0}'. This is most likely a permission problem. Unable to create the home directory ''{0}''. This is most likely a permission problem.
errorMessage.2=\ errorMessage.2=\
To change the home directory, use <tt>HUDSON_HOME</tt> environment variable or set the \ To change the home directory, use <tt>HUDSON_HOME</tt> environment variable or set the \
<tt>HUDSON_HOME</tt> system property. \ <tt>HUDSON_HOME</tt> system property. \
See <a href="http://wiki.hudson-ci.org/display/HUDSON/Containers">Container-specific documentation</a> \ See <a href="http://wiki.hudson-ci.org/display/HUDSON/Containers">Container-specific documentation</a> \
for more details of how to do this. for more details of how to do this.
# The MIT License # The MIT License
# #
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Simon Wiest # Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi, Simon Wiest
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
Error=Fehler Error=Fehler
errorMessage.1=\ errorMessage.1=\
Das Stammverzeichnis '{0}' konnte nicht angelegt werden. In den meisten Fällen ist \ Das Stammverzeichnis ''{0}'' konnte nicht angelegt werden. In den meisten Fällen ist \
dies ein Dateirechte-Problem. dies ein Dateirechte-Problem.
errorMessage.2=\ errorMessage.2=\
Um das Stammverzeichnis zu ändern, verwenden Sie die Umgebungsvariable <tt>HUDSON_HOME</tt> \ Um das Stammverzeichnis zu ändern, verwenden Sie die Umgebungsvariable <tt>HUDSON_HOME</tt> \
......
# The MIT License # The MIT License
# #
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe # Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
Error=\u30A8\u30E9\u30FC Error=\u30A8\u30E9\u30FC
errorMessage.1=\ errorMessage.1=\
\u30DB\u30FC\u30E0\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA '{0}' \u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u304A\u305D\u3089\u304F\u30D1\u30FC\u30DF\u30C3\u30B7\u30E7\u30F3\u306E\u554F\u984C\u3067\u3059\u3002 \u30DB\u30FC\u30E0\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA ''{0}'' \u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u304A\u305D\u3089\u304F\u30D1\u30FC\u30DF\u30C3\u30B7\u30E7\u30F3\u306E\u554F\u984C\u3067\u3059\u3002
errorMessage.2=\ errorMessage.2=\
\u30DB\u30FC\u30E0\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u5909\u66F4\u3059\u308B\u306B\u306F\u3001\u74B0\u5883\u5909\u6570\u306E<tt>HUDSON_HOME</tt>\u304B\u3001\u30B7\u30B9\u30C6\u30E0\u30D7\u30ED\u30D1\u30C6\u30A3\u306E \ \u30DB\u30FC\u30E0\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u5909\u66F4\u3059\u308B\u306B\u306F\u3001\u74B0\u5883\u5909\u6570\u306E<tt>HUDSON_HOME</tt>\u304B\u3001\u30B7\u30B9\u30C6\u30E0\u30D7\u30ED\u30D1\u30C6\u30A3\u306E \
<tt>HUDSON_HOME</tt>\u3092\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002\ <tt>HUDSON_HOME</tt>\u3092\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002\
......
...@@ -21,12 +21,12 @@ ...@@ -21,12 +21,12 @@
# THE SOFTWARE. # THE SOFTWARE.
# \ # \
# Unable to create the home directory '{0}'. This is most likely a permission problem. # Unable to create the home directory ''{0}''. This is most likely a permission problem.
errorMessage.1= #errorMessage.1=
Error=Erro Error=Erro
# \ # \
# To change the home directory, use <tt>HUDSON_HOME</tt> environment variable or set the \ # To change the home directory, use <tt>HUDSON_HOME</tt> environment variable or set the \
# <tt>HUDSON_HOME</tt> system property. \ # <tt>HUDSON_HOME</tt> system property. \
# See <a href="http://wiki.hudson-ci.org/display/HUDSON/Containers">Container-specific documentation</a> \ # See <a href="http://wiki.hudson-ci.org/display/HUDSON/Containers">Container-specific documentation</a> \
# for more details of how to do this. # for more details of how to do this.
errorMessage.2= #errorMessage.2=
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册