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/hdf | |
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/hdf')
-rw-r--r-- | java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java index 5ae977d..3a1361a 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 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 long getMinorErrorNumber() + { + return minorErrorNumber; + } + private native long _getMinorErrorNumber(); /** * Return a error message for the minor error number. |