From 6b46d63201a0ba6663c63973965a9f74754a1b5e Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sat, 18 Oct 2008 23:36:30 +0000 Subject: [PATCH] return NOTIMPL if ProcFd fails --- .../src/org/hyperic/sigar/jmx/SigarProcess.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bindings/java/src/org/hyperic/sigar/jmx/SigarProcess.java b/bindings/java/src/org/hyperic/sigar/jmx/SigarProcess.java index 7c766bf2..2690566d 100644 --- a/bindings/java/src/org/hyperic/sigar/jmx/SigarProcess.java +++ b/bindings/java/src/org/hyperic/sigar/jmx/SigarProcess.java @@ -34,6 +34,7 @@ import org.hyperic.sigar.SigarProxyCache; public class SigarProcess implements SigarProcessMBean { + private static final Long NOTIMPL = new Long(Sigar.FIELD_NOTIMPL); private Sigar sigarImpl; private SigarProxy sigar; private long pid = -1; @@ -75,12 +76,8 @@ public class SigarProcess implements SigarProcessMBean { } } - private synchronized ProcFd getFd() { - try { - return this.sigar.getProcFd(getPid()); - } catch (SigarException e) { - throw unexpectedError("Fd", e); - } + private synchronized ProcFd getFd() throws SigarException { + return this.sigar.getProcFd(getPid()); } public String getObjectName() throws SigarException { @@ -150,6 +147,10 @@ public class SigarProcess implements SigarProcessMBean { } public Long getOpenFd() { - return new Long(getFd().getTotal()); + try { + return new Long(getFd().getTotal()); + } catch (SigarException e) { + return NOTIMPL; + } } }