code: protected File getHomeDir() {
          // check JNDI for the home directory first
          String varName = getApplicationName().toUpperCase() + "_HOME";
          try {
              InitialContext iniCtxt = new InitialContext();
              Context env = (Context) iniCtxt.lookup("java:comp/env");
              String value = (String) env.lookup(varName);
              if(value!=null && value.trim().length()>0)
                  return new File(value.trim());
              // look at one more place. See HUDSON-1314
              value = (String) iniCtxt.lookup(varName);
              if(value!=null && value.trim().length()>0)
                  return new File(value.trim());
          } catch (NamingException e) {
              // ignore
          }
  
          // finally check the system property
          String sysProp = System.getProperty(varName);
          if(sysProp!=null)
              return new File(sysProp.trim());
  
          // look at the env var next
          String env = System.getenv(varName);
          if(env!=null)
              return new File(env.trim()).getAbsoluteFile();
  
          return getDefaultHomeDir();
      }
docs: Determines the home directory for the application.
  
  People makes configuration mistakes, so we are trying to be nice
  with those by doing {@link String#trim()}.