map EACCES/ERROR_ACCESS_DENIED to SigarPermissionDeniedException

This commit is contained in:
Doug MacEachern 2004-08-18 15:46:34 +00:00
parent 9ebf365efd
commit ad85def2fb
1 changed files with 10 additions and 0 deletions

View File

@ -77,6 +77,12 @@ static void sigar_throw_notimpl(JNIEnv *env, char *msg)
# define SIGAR_ENOENT ENOENT
#endif
#ifdef WIN32
# define SIGAR_EACCES ERROR_ACCESS_DENIED
#else
# define SIGAR_EACCES EACCES
#endif
static void sigar_throw_error(JNIEnv *env, jni_sigar_t *jsigar, int err)
{
jclass errorClass;
@ -86,6 +92,10 @@ static void sigar_throw_error(JNIEnv *env, jni_sigar_t *jsigar, int err)
errorClass = SIGAR_FIND_CLASS("SigarFileNotFoundException");
break;
case SIGAR_EACCES:
errorClass = SIGAR_FIND_CLASS("SigarPermissionDeniedException");
break;
case SIGAR_ENOTIMPL:
if (jsigar->not_impl == NULL) {
jfieldID id;