improved the error handling on failure to create hudson home (issue #558)

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@3352 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2007-05-25 23:08:00 +00:00
1 parent efa072c232
commit e298fe3413
3 files changed
+44 -1

No files matched your search

+8 -1
View File
@@ -8,6 +8,7 @@ import hudson.triggers.Trigger;
import hudson.util.IncompatibleServletVersionDetected;
import hudson.util.IncompatibleVMDetected;
import hudson.util.RingBufferLogHandler;
import hudson.util.NoHomeDir;
import javax.naming.Context;
import javax.naming.InitialContext;
@@ -40,11 +41,17 @@ public class WebAppMain implements ServletContextListener {
public void contextInitialized(ServletContextEvent event) {
installLogger();
ServletContext context = event.getServletContext();
File home = getHomeDir(event);
home.mkdirs();
System.out.println("hudson home directory: "+home);
ServletContext context = event.getServletContext();
// check that home exists (as mkdirs could have failed silently), otherwise throw a meaningful error
if (! home.exists()) {
context.setAttribute("app",new NoHomeDir(home));
return;
}
// make sure that we are using XStream in the "enhanced" (JVM-specific) mode
if(new JVM().bestReflectionProvider().getClass()==PureJavaReflectionProvider.class) {