map ERROR_FILE_NOT_FOUND to SigarFileNotFoundException on win32

This commit is contained in:
Doug MacEachern 2004-08-18 15:32:36 +00:00
parent 37a7853ccc
commit c96ab5c880
1 changed files with 8 additions and 5 deletions

View File

@ -71,18 +71,21 @@ static void sigar_throw_notimpl(JNIEnv *env, char *msg)
JENV->ThrowNew(env, errorClass, msg); JENV->ThrowNew(env, errorClass, msg);
} }
#ifdef WIN32
# define SIGAR_ENOENT ERROR_FILE_NOT_FOUND
#else
# define SIGAR_ENOENT ENOENT
#endif
static void sigar_throw_error(JNIEnv *env, jni_sigar_t *jsigar, int err) static void sigar_throw_error(JNIEnv *env, jni_sigar_t *jsigar, int err)
{ {
jclass errorClass; jclass errorClass;
switch (err) { switch (err) {
#ifndef WIN32 case SIGAR_ENOENT:
case ENOENT:
errorClass = SIGAR_FIND_CLASS("SigarFileNotFoundException"); errorClass = SIGAR_FIND_CLASS("SigarFileNotFoundException");
break; break;
#else
/*XXX*/
#endif
case SIGAR_ENOTIMPL: case SIGAR_ENOTIMPL:
if (jsigar->not_impl == NULL) { if (jsigar->not_impl == NULL) {
jfieldID id; jfieldID id;