@Test(expected = IllegalStateException.class) public void getInstallationDirectoryThrowsIllegalStateException() { system.getInstallationDirectory(); }
public File getInstallationDirectory() { File dir; try { ProtectionDomain pd = Hudson.class.getProtectionDomain(); CodeSource cs = pd.getCodeSource(); URL url = cs.getLocation(); String path = url.getPath(); dir = new File(path); dir = dir.getParentFile().getParentFile(); dir = FileUtil.canonicalize(dir); } catch (NullPointerException e) { throw new IllegalStateException("Could not reliably determine the installation directory", e); } return dir; }
SystemServiceImpl extends ServiceSupport implements SystemService { public File getInstallationDirectory() { File dir; try { ProtectionDomain pd = Hudson.class.getProtectionDomain(); CodeSource cs = pd.getCodeSource(); URL url = cs.getLocation(); String path = url.getPath(); dir = new File(path); dir = dir.getParentFile().getParentFile(); dir = FileUtil.canonicalize(dir); } catch (NullPointerException e) { throw new IllegalStateException("Could not reliably determine the installation directory", e); } return dir; } }
SystemServiceImpl extends ServiceSupport implements SystemService { public File getInstallationDirectory() { File dir; try { ProtectionDomain pd = Hudson.class.getProtectionDomain(); CodeSource cs = pd.getCodeSource(); URL url = cs.getLocation(); String path = url.getPath(); dir = new File(path); dir = dir.getParentFile().getParentFile(); dir = FileUtil.canonicalize(dir); } catch (NullPointerException e) { throw new IllegalStateException("Could not reliably determine the installation directory", e); } return dir; } @Inject  SystemServiceImpl(final SecurityService securityService); }
SystemServiceImpl extends ServiceSupport implements SystemService { public File getInstallationDirectory() { File dir; try { ProtectionDomain pd = Hudson.class.getProtectionDomain(); CodeSource cs = pd.getCodeSource(); URL url = cs.getLocation(); String path = url.getPath(); dir = new File(path); dir = dir.getParentFile().getParentFile(); dir = FileUtil.canonicalize(dir); } catch (NullPointerException e) { throw new IllegalStateException("Could not reliably determine the installation directory", e); } return dir; } @Inject  SystemServiceImpl(final SecurityService securityService); File getInstallationDirectory(); File getLogDirectory(); File getWorkingDirectory(); XmlFile getConfigFile(); String getUrl(); String getVersion(); InitMilestone getInitLevel(); boolean isQuietingDown(); boolean isTerminating(); String getSystemMessage(); void doQuietDown(); void doQuietDown(boolean toggle); void doCancelQuietDown(); void doReload(); void doRestart(boolean safely); void doRestart(); void doRestartSafely(); }
SystemServiceImpl extends ServiceSupport implements SystemService { public File getInstallationDirectory() { File dir; try { ProtectionDomain pd = Hudson.class.getProtectionDomain(); CodeSource cs = pd.getCodeSource(); URL url = cs.getLocation(); String path = url.getPath(); dir = new File(path); dir = dir.getParentFile().getParentFile(); dir = FileUtil.canonicalize(dir); } catch (NullPointerException e) { throw new IllegalStateException("Could not reliably determine the installation directory", e); } return dir; } @Inject  SystemServiceImpl(final SecurityService securityService); File getInstallationDirectory(); File getLogDirectory(); File getWorkingDirectory(); XmlFile getConfigFile(); String getUrl(); String getVersion(); InitMilestone getInitLevel(); boolean isQuietingDown(); boolean isTerminating(); String getSystemMessage(); void doQuietDown(); void doQuietDown(boolean toggle); void doCancelQuietDown(); void doReload(); void doRestart(boolean safely); void doRestart(); void doRestartSafely();  }