From 35362e9dab88a7331e111dff096b4313e8f8f36f Mon Sep 17 00:00:00 2001 From: kohsuke Date: Fri, 14 Mar 2008 05:42:23 +0000 Subject: [PATCH] Looking at one more place (#1314) git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@7728 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/WebAppMain.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/WebAppMain.java b/core/src/main/java/hudson/WebAppMain.java index 71789bfcdf..1604a0ed43 100644 --- a/core/src/main/java/hudson/WebAppMain.java +++ b/core/src/main/java/hudson/WebAppMain.java @@ -226,10 +226,15 @@ public class WebAppMain implements ServletContextListener { private File getHomeDir(ServletContextEvent event) { // check JNDI for the home directory first try { - Context env = (Context) new InitialContext().lookup("java:comp/env"); + InitialContext iniCtxt = new InitialContext(); + Context env = (Context) iniCtxt.lookup("java:comp/env"); String value = (String) env.lookup("HUDSON_HOME"); if(value!=null && value.trim().length()>0) return new File(value.trim()); + // look at one more place. See issue #1314 + value = (String) iniCtxt.lookup("HUDSON_HOME"); + if(value!=null && value.trim().length()>0) + return new File(value.trim()); } catch (NamingException e) { // ignore }