提交 06516327 编写于 作者: J jbq

Compute version number before loading Hudson, so that the HudsonIsLoading page

displays a version number


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@4802 71c3de6d-444a-0410-be80-ed276b4c234a
上级 83353068
......@@ -100,31 +100,14 @@ public class WebAppMain implements ServletContextListener {
new Thread("hudson initialization thread") {
public void run() {
computeVersion(context);
try {
context.setAttribute("app",new Hudson(home,context));
} catch( IOException e ) {
throw new Error(e);
}
// set the version
Properties props = new Properties();
try {
InputStream is = getClass().getResourceAsStream("hudson-version.properties");
if(is!=null)
props.load(is);
} catch (IOException e) {
e.printStackTrace(); // if the version properties is missing, that's OK.
}
String ver = props.getProperty("version");
if(ver==null) ver="?";
Hudson.VERSION = ver;
context.setAttribute("version",ver);
if(ver.equals("?"))
Hudson.RESOURCE_PATH = "";
else
Hudson.RESOURCE_PATH = "/static/"+Util.getDigestOf(ver).substring(0,8);
Trigger.init(); // start running trigger
// trigger the loading of changelogs in the background,
......@@ -139,7 +122,28 @@ public class WebAppMain implements ServletContextListener {
}.start();
}
/**
protected void computeVersion(ServletContext context) {
// set the version
Properties props = new Properties();
try {
InputStream is = getClass().getResourceAsStream("hudson-version.properties");
if(is!=null)
props.load(is);
} catch (IOException e) {
e.printStackTrace(); // if the version properties is missing, that's OK.
}
String ver = props.getProperty("version");
if(ver==null) ver="?";
Hudson.VERSION = ver;
context.setAttribute("version",ver);
if(ver.equals("?"))
Hudson.RESOURCE_PATH = "";
else
Hudson.RESOURCE_PATH = "/static/"+Util.getDigestOf(ver).substring(0,8);
}
/**
* Installs log handler to monitor all Hudson logs.
*/
private void installLogger() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册