summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2018-08-06 14:15:08 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2018-08-06 14:15:08 (GMT)
commitca7d4f85a5054fc406e62ccb009169e139f0105c (patch)
tree719110c38ca5d62a2a688a6598b2a734e17a63cd /java
parent762c14fde587f2ff4f9b9cdaa6b2232a481edde4 (diff)
downloadhdf5-ca7d4f85a5054fc406e62ccb009169e139f0105c.zip
hdf5-ca7d4f85a5054fc406e62ccb009169e139f0105c.tar.gz
hdf5-ca7d4f85a5054fc406e62ccb009169e139f0105c.tar.bz2
HDFFV-10544 exception variable as local class
Diffstat (limited to 'java')
-rw-r--r--java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java23
-rw-r--r--java/src/jni/exceptionImp.c12
-rw-r--r--java/src/jni/exceptionImp.h8
3 files changed, 28 insertions, 15 deletions
diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java
index 5ae977d..ad5c2ab 100644
--- a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java
+++ b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java
@@ -30,6 +30,9 @@ import hdf.hdf5lib.HDF5Constants;
@SuppressWarnings("serial")
public class HDF5LibraryException extends HDF5Exception {
+ private final long majorErrorNumber;
+ private final long minorErrorNumber;
+
/**
* Constructs an <code>HDF5LibraryException</code> with no specified detail
* message.
@@ -44,9 +47,10 @@ public class HDF5LibraryException extends HDF5Exception {
}
catch (Exception e) {
}
- ;
- detailMessage = getMinorError(getMinorErrorNumber());
+ this.majorErrorNumber = _getMajorErrorNumber();
+ this.minorErrorNumber = _getMinorErrorNumber();
+ detailMessage = getMinorError(minorErrorNumber());
}
/**
@@ -65,7 +69,8 @@ public class HDF5LibraryException extends HDF5Exception {
}
catch (Exception e) {
}
- ;
+ this.majorErrorNumber = _getMajorErrorNumber();
+ this.minorErrorNumber = _getMinorErrorNumber();
}
/**
@@ -74,7 +79,11 @@ public class HDF5LibraryException extends HDF5Exception {
*
* @return the major error number
*/
- public native long getMajorErrorNumber();
+ public native long getMajorErrorNumber()
+ {
+ return majorErrorNumber;
+ }
+ private native long _getMajorErrorNumber();
/**
* Get the minor error number of the first error on the HDF5 library error
@@ -82,7 +91,11 @@ public class HDF5LibraryException extends HDF5Exception {
*
* @return the minor error number
*/
- public native long getMinorErrorNumber();
+ public native long getMinorErrorNumber()
+ {
+ return minorErrorNumber;
+ }
+ private native long _getMinorErrorNumber();
/**
* Return a error message for the minor error number.
diff --git a/java/src/jni/exceptionImp.c b/java/src/jni/exceptionImp.c
index ded632d..e122eb2 100644
--- a/java/src/jni/exceptionImp.c
+++ b/java/src/jni/exceptionImp.c
@@ -179,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;
@@ -195,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;
@@ -215,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
diff --git a/java/src/jni/exceptionImp.h b/java/src/jni/exceptionImp.h
index 423e537..5873202 100644
--- a/java/src/jni/exceptionImp.h
+++ b/java/src/jni/exceptionImp.h
@@ -55,20 +55,20 @@ Java_hdf_hdf5lib_exceptions_HDF5LibraryException_printStackTrace0
/*
* Class: hdf_hdf5lib_exceptions_HDFLibraryException
- * Method: getMajorErrorNumber
+ * Method: _getMajorErrorNumber
* Signature: ()J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMajorErrorNumber
+Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMajorErrorNumber
(JNIEnv *env, jobject obj);
/*
* Class: hdf_hdf5lib_exceptions_HDFLibraryException
- * Method: getMinorErrorNumber
+ * Method: _getMinorErrorNumber
* Signature: ()J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMinorErrorNumber
+Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMinorErrorNumber
(JNIEnv *env, jobject obj);
#ifdef __cplusplus