catch SigarPermissionDeniedException (e.g. FreeBSD /dev/kmem)

This commit is contained in:
Doug MacEachern 2006-04-03 16:50:38 +00:00
parent 933b7734a6
commit db0622d030
2 changed files with 6 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import java.util.Map;
import net.hyperic.sigar.Sigar; import net.hyperic.sigar.Sigar;
import net.hyperic.sigar.SigarException; import net.hyperic.sigar.SigarException;
import net.hyperic.sigar.SigarNotImplementedException; import net.hyperic.sigar.SigarNotImplementedException;
import net.hyperic.sigar.SigarPermissionDeniedException;
public class TestProcEnv extends SigarTestCase { public class TestProcEnv extends SigarTestCase {
@ -46,6 +47,8 @@ public class TestProcEnv extends SigarTestCase {
assertTrue(val == null); assertTrue(val == null);
} catch (SigarNotImplementedException e) { } catch (SigarNotImplementedException e) {
//ok //ok
} catch (SigarPermissionDeniedException e) {
//ok
} }
} }
} }

View File

@ -7,6 +7,7 @@ import net.hyperic.sigar.Sigar;
import net.hyperic.sigar.SigarException; import net.hyperic.sigar.SigarException;
import net.hyperic.sigar.SigarLoader; import net.hyperic.sigar.SigarLoader;
import net.hyperic.sigar.SigarNotImplementedException; import net.hyperic.sigar.SigarNotImplementedException;
import net.hyperic.sigar.SigarPermissionDeniedException;
public class TestProcFd extends SigarTestCase { public class TestProcFd extends SigarTestCase {
@ -42,6 +43,8 @@ public class TestProcFd extends SigarTestCase {
sigar.getProcFd(pid).getTotal()); sigar.getProcFd(pid).getTotal());
} catch (SigarNotImplementedException e) { } catch (SigarNotImplementedException e) {
//ok //ok
} catch (SigarPermissionDeniedException e) {
//ok
} }
} }
} }