diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2018-08-06 18:15:50 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2018-08-06 18:15:50 (GMT) |
commit | 78c4623235ea54ec2adc9d079e9f5c9e87f870ba (patch) | |
tree | a90becb4636cf1f659d004caf84cfdda4edc20c4 /java/src/jni/exceptionImp.c | |
parent | 51a5d112ade5dd3de0b9e62a38ab4dc888bf5cf5 (diff) | |
download | hdf5-78c4623235ea54ec2adc9d079e9f5c9e87f870ba.zip hdf5-78c4623235ea54ec2adc9d079e9f5c9e87f870ba.tar.gz hdf5-78c4623235ea54ec2adc9d079e9f5c9e87f870ba.tar.bz2 |
HDFFV-10544 Improve JNI exception handling
Diffstat (limited to 'java/src/jni/exceptionImp.c')
-rw-r--r-- | java/src/jni/exceptionImp.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/java/src/jni/exceptionImp.c b/java/src/jni/exceptionImp.c index afad5d5..ccda0d2 100644 --- a/java/src/jni/exceptionImp.c +++ b/java/src/jni/exceptionImp.c @@ -83,11 +83,16 @@ typedef struct H5E_num_t { } \ jm = ENVPTR->GetMethodID(ENVPAR jc, "<init>", "(Ljava/lang/String;)V"); \ if (jm == NULL) { \ + printf("THROWEXCEPTION FATAL ERROR: GetMethodID failed\n"); \ return JNI_FALSE; \ } \ ex = ENVPTR->NewObjectA (ENVPAR jc, jm, (jvalue*)(args)); \ + if (ex == NULL) { \ + printf("THROWEXCEPTION FATAL ERROR: %s: Creation failed\n", (className)); \ + return JNI_FALSE; \ + } \ if (ENVPTR->Throw(ENVPAR (jthrowable)ex) < 0) { \ - printf("FATAL ERROR: %s: Throw failed\n", (className)); \ + printf("THROWEXCEPTION FATAL ERROR: %s: Throw failed\n", (className)); \ return JNI_FALSE; \ } \ return JNI_TRUE; \ @@ -174,13 +179,13 @@ Java_hdf_hdf5lib_exceptions_HDF5LibraryException_printStackTrace0 /* * Class: hdf_hdf5lib_exceptions_HDFLibraryException - * Method: getMajorErrorNumber + * Method: _getMajorErrorNumber * Signature: ()J * * Extract the HDF-5 major error number from the HDF-5 error stack. */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMajorErrorNumber +Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMajorErrorNumber (JNIEnv *env, jobject obj) { H5E_num_t err_nums; @@ -190,17 +195,17 @@ Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMajorErrorNumber H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &err_nums); return err_nums.maj_num; -} /* end Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMajorErrorNumber() */ +} /* end Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMajorErrorNumber() */ /* * Class: hdf_hdf5lib_exceptions_HDFLibraryException - * Method: getMinorErrorNumber + * Method: _getMinorErrorNumber * Signature: ()J * * Extract the HDF-5 minor error number from the HDF-5 error stack. */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMinorErrorNumber +Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMinorErrorNumber (JNIEnv *env, jobject obj) { H5E_num_t err_nums; @@ -210,7 +215,7 @@ Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMinorErrorNumber H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &err_nums); return err_nums.min_num; -} /* end Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMinorErrorNumber() */ +} /* end Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMinorErrorNumber() */ /* * Routine to raise particular Java exceptions from C |