From c66f80fa06d67473fbf0746b63d4fffc550e64c2 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Fri, 11 Mar 2005 04:14:27 +0000 Subject: [PATCH] windows service file is not in /etc/services --- bindings/java/src/net/hyperic/sigar/NetPortMap.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bindings/java/src/net/hyperic/sigar/NetPortMap.java b/bindings/java/src/net/hyperic/sigar/NetPortMap.java index 01a9c2dd..69f871fa 100644 --- a/bindings/java/src/net/hyperic/sigar/NetPortMap.java +++ b/bindings/java/src/net/hyperic/sigar/NetPortMap.java @@ -14,11 +14,22 @@ import java.util.StringTokenizer; public class NetPortMap { + private static final String SERVICE_FILE; + private static Map udpServices = null; private static Map tcpServices = null; + static { + if (SigarLoader.IS_WIN32) { + SERVICE_FILE = "C:\\windows\\system32\\drivers\\etc\\services"; + } + else { + SERVICE_FILE = "/etc/services"; + } + } + private static void parseServices(String type, Map services) { - File file = new File("/etc/services"); + File file = new File(SERVICE_FILE); if (!file.exists()) { return; }