From bdd27d6f36144cc9b0740db6dcbea7557cb449c3 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 26 Nov 2008 01:08:02 +0000 Subject: [PATCH] handle processes that may have gone away --- bindings/java/src/org/hyperic/sigar/cmd/Top.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bindings/java/src/org/hyperic/sigar/cmd/Top.java b/bindings/java/src/org/hyperic/sigar/cmd/Top.java index 339f2647..dbd2ee0f 100644 --- a/bindings/java/src/org/hyperic/sigar/cmd/Top.java +++ b/bindings/java/src/org/hyperic/sigar/cmd/Top.java @@ -83,7 +83,12 @@ public class Top { String cpuPerc = "?"; - List info = Ps.getInfo(sigar, pid); + List info; + try { + info = Ps.getInfo(sigar, pid); + } catch (SigarException e) { + continue; //process may have gone away + } try { ProcCpu cpu = sigar.getProcCpu(pid); cpuPerc = CpuPerc.format(cpu.getPercent());