Source:
<code>private FirefoxDriver getNegotiatingFirefox(KerberosContainer kdc, String tokenCache) { FirefoxProfile profile = new FirefoxProfile(); profile.setAlwaysLoadNoFocusLib(true); String trustedUris = jenkins.url.toExternalForm(); String jenkins_local_hostname = System.getenv("JENKINS_LOCAL_HOSTNAME"); if (jenkins_local_hostname != null && !jenkins_local_hostname.isEmpty()) { trustedUris = trustedUris + ", " + jenkins_local_hostname; <START> } <END> try { trustedUris = trustedUris + ", " + Inet4Address.getLocalHost().getHostName(); } catch (UnknownHostException e) { e.printStackTrace(); throw new Error(e); } profile.setPreference("network.negotiate-auth.trusted-uris", trustedUris); profile.setPreference("network.negotiate-auth.delegation-uris", trustedUris); FirefoxBinary binary = new FirefoxBinary(); binary.setEnvironmentProperty("KRB5CCNAME", tokenCache); binary.setEnvironmentProperty("KRB5_CONFIG", kdc.getKrb5ConfPath()); binary.setEnvironmentProperty("KRB5_TRACE", diag.touch("krb5_trace.log").getAbsolutePath()); binary.setEnvironmentProperty("NSPR_LOG_MODULES", "negotiateauth:5"); binary.setEnvironmentProperty("NSPR_LOG_FILE", diag.touch("firefox.nego.log").getAbsolutePath()); String display = FallbackConfig.getBrowserDisplay(); if (display != null) { binary.setEnvironmentProperty("DISPLAY", display); } final FirefoxDriver driver = new FirefoxDriver(binary, profile); cleaner.addTask(new Statement() { @Override public void evaluate() throws Throwable { try { driver.quit(); } catch (UnreachableBrowserException ex) { System.err.println("Browser died already"); ex.printStackTrace(); } } @Override public String toString() { return "Close Kerberos WebDriver after test"; } }); return driver; }</code><technical_language>If variable is set, jenkins.url is already</technical_language>

Target:
private FirefoxDriver getNegotiatingFirefox(KerberosContainer kdc, String tokenCache) { FirefoxProfile profile = new FirefoxProfile(); profile.setAlwaysLoadNoFocusLib(true); String trustedUris = jenkins.url.toExternalForm(); String jenkins_local_hostname = System.getenv("JENKINS_LOCAL_HOSTNAME"); if (jenkins_local_hostname != null && !jenkins_local_hostname.isEmpty()) { try { String hostName = InetAddress.getByName(jenkins_local_hostname).getCanonicalHostName(); trustedUris = trustedUris + ", " + hostName; } catch (UnknownHostException e) { e.printStackTrace(); throw new Error(e); } } profile.setPreference("network.negotiate-auth.trusted-uris", trustedUris); profile.setPreference("network.negotiate-auth.delegation-uris", trustedUris); FirefoxBinary binary = new FirefoxBinary(); binary.setEnvironmentProperty("KRB5CCNAME", tokenCache); binary.setEnvironmentProperty("KRB5_CONFIG", kdc.getKrb5ConfPath()); binary.setEnvironmentProperty("KRB5_TRACE", diag.touch("krb5_trace.log").getAbsolutePath()); binary.setEnvironmentProperty("NSPR_LOG_MODULES", "negotiateauth:5"); binary.setEnvironmentProperty("NSPR_LOG_FILE", diag.touch("firefox.nego.log").getAbsolutePath()); String display = FallbackConfig.getBrowserDisplay(); if (display != null) { binary.setEnvironmentProperty("DISPLAY", display); } final FirefoxDriver driver = new FirefoxDriver(binary, profile); cleaner.addTask(new Statement() { @Override public void evaluate() throws Throwable { try { driver.quit(); } catch (UnreachableBrowserException ex) { System.err.println("Browser died already"); ex.printStackTrace(); } } @Override public String toString() { return "Close Kerberos WebDriver after test"; } }); return driver; }