diff --git a/core/src/main/java/hudson/os/windows/ManagedWindowsServiceLauncher.java b/core/src/main/java/hudson/os/windows/ManagedWindowsServiceLauncher.java index 64e83843b906d94aaf028251ca7bf1265ab51e4d..0fc1c5713a6ee7ce691c9680437549494a4dd96c 100644 --- a/core/src/main/java/hudson/os/windows/ManagedWindowsServiceLauncher.java +++ b/core/src/main/java/hudson/os/windows/ManagedWindowsServiceLauncher.java @@ -212,14 +212,7 @@ public class ManagedWindowsServiceLauncher extends ComputerLauncher { // // continue anyway, just in case it's just ICMP that's getting filtered // } - try { - Socket s = new Socket(); - s.connect(new InetSocketAddress(host,135),5000); - s.close(); - } catch (IOException e) { - logger.println("Failed to connect to port 135 of "+name+". Is Windows firewall blocking this port? Or did you disable DCOM service?"); - // again, let it continue. - } + checkPort135Access(logger, name, host); JIDefaultAuthInfoImpl auth = createAuth(); JISession session = JISession.createSession(auth); @@ -386,6 +379,18 @@ public class ManagedWindowsServiceLauncher extends ComputerLauncher { } } + private void checkPort135Access(PrintStream logger, String name, InetAddress host) throws IOException { + Socket s = new Socket(); + try { + s.connect(new InetSocketAddress(host,135),5000); + } catch (IOException e) { + logger.println("Failed to connect to port 135 of "+name+". Is Windows firewall blocking this port? Or did you disable DCOM service?"); + // again, let it continue. + } finally { + s.close(); + } + } + /** * Determines the host name (or the IP address) to connect to. */