catch SigarPermissionDeniedException
This commit is contained in:
parent
aa509c7a83
commit
91925050b6
|
@ -23,6 +23,7 @@ import org.hyperic.sigar.NetFlags;
|
|||
import org.hyperic.sigar.NetInfo;
|
||||
import org.hyperic.sigar.NetInterfaceConfig;
|
||||
import org.hyperic.sigar.SigarException;
|
||||
import org.hyperic.sigar.SigarPermissionDeniedException;
|
||||
|
||||
public class TestNetInfo extends SigarTestCase {
|
||||
|
||||
|
@ -39,8 +40,14 @@ public class TestNetInfo extends SigarTestCase {
|
|||
|
||||
int flags = NetFlags.CONN_SERVER | NetFlags.CONN_TCP;
|
||||
|
||||
NetConnection[] connections =
|
||||
getSigar().getNetConnectionList(flags);
|
||||
NetConnection[] connections;
|
||||
|
||||
try {
|
||||
connections =
|
||||
getSigar().getNetConnectionList(flags);
|
||||
} catch (SigarPermissionDeniedException e) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i=0; i<connections.length; i++) {
|
||||
long port = connections[i].getLocalPort();
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.hyperic.sigar.NetFlags;
|
|||
import org.hyperic.sigar.NetStat;
|
||||
import org.hyperic.sigar.Sigar;
|
||||
import org.hyperic.sigar.SigarNotImplementedException;
|
||||
import org.hyperic.sigar.SigarPermissionDeniedException;
|
||||
|
||||
public class TestNetStat extends SigarTestCase {
|
||||
|
||||
|
@ -38,6 +39,8 @@ public class TestNetStat extends SigarTestCase {
|
|||
netstat = sigar.getNetStat();
|
||||
} catch (SigarNotImplementedException e) {
|
||||
return;
|
||||
} catch (SigarPermissionDeniedException e) {
|
||||
return;
|
||||
}
|
||||
|
||||
traceln("");
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.hyperic.sigar.NetInterfaceConfig;
|
|||
import org.hyperic.sigar.NetStat;
|
||||
import org.hyperic.sigar.Sigar;
|
||||
import org.hyperic.sigar.SigarNotImplementedException;
|
||||
import org.hyperic.sigar.SigarPermissionDeniedException;
|
||||
|
||||
public class TestNetStatPort extends SigarTestCase {
|
||||
|
||||
|
@ -45,6 +46,8 @@ public class TestNetStatPort extends SigarTestCase {
|
|||
netstat = sigar.getNetStat(address.getAddress(), port);
|
||||
} catch (SigarNotImplementedException e) {
|
||||
return;
|
||||
} catch (SigarPermissionDeniedException e) {
|
||||
return;
|
||||
}
|
||||
|
||||
assertGtEqZeroTrace("AllOutbound", netstat.getAllOutboundTotal());
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.hyperic.sigar.test;
|
|||
|
||||
import org.hyperic.sigar.Sigar;
|
||||
import org.hyperic.sigar.SigarNotImplementedException;
|
||||
import org.hyperic.sigar.SigarPermissionDeniedException;
|
||||
import org.hyperic.sigar.Tcp;
|
||||
|
||||
public class TestTcpStat extends SigarTestCase {
|
||||
|
@ -36,6 +37,8 @@ public class TestTcpStat extends SigarTestCase {
|
|||
tcp = sigar.getTcp();
|
||||
} catch (SigarNotImplementedException e) {
|
||||
return;
|
||||
} catch (SigarPermissionDeniedException e) {
|
||||
return;
|
||||
}
|
||||
|
||||
traceln("");
|
||||
|
|
Loading…
Reference in New Issue