make invoker SigarPermissionDeniedException aware

This commit is contained in:
Doug MacEachern 2008-07-14 00:52:32 +00:00
parent 4fd928a3db
commit aa509c7a83
3 changed files with 16 additions and 3 deletions

View File

@ -201,7 +201,9 @@ public class SigarInvoker {
}
public Object invoke(Object arg, String attr)
throws SigarException, SigarNotImplementedException {
throws SigarException,
SigarNotImplementedException,
SigarPermissionDeniedException {
Object[] args = null;
@ -218,7 +220,9 @@ public class SigarInvoker {
}
public Object invoke(Object[] args, String attr)
throws SigarException, SigarNotImplementedException {
throws SigarException,
SigarNotImplementedException,
SigarPermissionDeniedException {
Method typeGetter, attrGetter;
Object typeObject;
@ -240,6 +244,9 @@ public class SigarInvoker {
if (t instanceof SigarNotImplementedException) {
throw (SigarNotImplementedException)t;
}
else if (t instanceof SigarPermissionDeniedException) {
throw (SigarPermissionDeniedException)t;
}
throw new SigarException(msg);
}

View File

@ -216,6 +216,9 @@ public class SigarProxyCache
if (t instanceof SigarNotImplementedException) {
throw new SigarNotImplementedException(msg);
}
else if (t instanceof SigarPermissionDeniedException) {
throw new SigarPermissionDeniedException(msg);
}
throw new SigarException(msg);
} catch (Exception e) {
String msg =

View File

@ -21,6 +21,7 @@ package org.hyperic.sigar.test;
import org.hyperic.sigar.Sigar;
import org.hyperic.sigar.SigarException;
import org.hyperic.sigar.SigarNotImplementedException;
import org.hyperic.sigar.SigarPermissionDeniedException;
import org.hyperic.sigar.SigarProxy;
import org.hyperic.sigar.SigarProxyCache;
import org.hyperic.sigar.jmx.SigarInvokerJMX;
@ -90,8 +91,10 @@ public class TestInvoker extends SigarTestCase {
assertTrue(true);
} catch (SigarNotImplementedException e) {
traceln(query[0] + " NotImplemented");
} catch (SigarPermissionDeniedException e) {
traceln(query[0] + " PermissionDenied");
} catch (SigarException e) {
traceln(query[0] + ":" + query[1] + "=" + e.getMessage());
traceln(query[0] + ":" + query[1] + "=" + e);
assertTrue(false);
}
}