From 7399997968b3521afb08e62880a3be586bd21cec Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 15 Mar 2018 13:41:25 -0500 Subject: Java constants for new lib verbounds values --- java/src/hdf/hdf5lib/HDF5Constants.java | 12 ++++++++++++ java/src/jni/h5Constants.c | 8 ++++++++ java/src/jni/h5pImp.c | 14 +++----------- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index 3e43ba2..eb4055d 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -206,7 +206,11 @@ public class HDF5Constants { public static final int H5F_CLOSE_SEMI = H5F_CLOSE_SEMI(); public static final int H5F_CLOSE_STRONG = H5F_CLOSE_STRONG(); public static final int H5F_CLOSE_WEAK = H5F_CLOSE_WEAK(); + public static final int H5F_LIBVER_ERROR = H5F_LIBVER_ERROR(); public static final int H5F_LIBVER_EARLIEST = H5F_LIBVER_EARLIEST(); + public static final int H5F_LIBVER_V18 = H5F_LIBVER_V18(); + public static final int H5F_LIBVER_V110 = H5F_LIBVER_V110(); + public static final int H5F_LIBVER_NBOUNDS = H5F_LIBVER_NBOUNDS(); public static final int H5F_LIBVER_LATEST = H5F_LIBVER_LATEST(); public static final int H5F_OBJ_ALL = H5F_OBJ_ALL(); public static final int H5F_OBJ_ATTR = H5F_OBJ_ATTR(); @@ -999,8 +1003,16 @@ public class HDF5Constants { private static native final int H5F_CLOSE_WEAK(); + private static native final int H5F_LIBVER_ERROR(); + private static native final int H5F_LIBVER_EARLIEST(); + private static native final int H5F_LIBVER_V18(); + + private static native final int H5F_LIBVER_V110(); + + private static native final int H5F_LIBVER_NBOUNDS(); + private static native final int H5F_LIBVER_LATEST(); private static native final int H5F_OBJ_ALL(); diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index 5a4b53e..fbbd332 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -380,8 +380,16 @@ Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1STRONG(JNIEnv *env, jclass cls) { ret JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1WEAK(JNIEnv *env, jclass cls) { return H5F_CLOSE_WEAK; } JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1EARLIEST(JNIEnv *env, jclass cls){return H5F_LIBVER_ERROR;} +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1EARLIEST(JNIEnv *env, jclass cls){return H5F_LIBVER_EARLIEST;} JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1EARLIEST(JNIEnv *env, jclass cls){return H5F_LIBVER_V18;} +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1EARLIEST(JNIEnv *env, jclass cls){return H5F_LIBVER_V110;} +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1EARLIEST(JNIEnv *env, jclass cls){return H5F_LIBVER_NBOUNDS;} +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1LATEST(JNIEnv *env, jclass cls){return H5F_LIBVER_LATEST;} JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1ALL(JNIEnv *env, jclass cls) { return H5F_OBJ_ALL; } diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index cf27341..49cfeb9 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -2794,17 +2794,9 @@ Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds { herr_t retVal = -1; - if ((H5F_libver_t)high != H5F_LIBVER_LATEST) { - h5badArgument(env, "H5Pset_libver_bounds: invalid high library version bound"); - } /* end if */ - else if(((H5F_libver_t)low !=H5F_LIBVER_EARLIEST) && ((H5F_libver_t)low != H5F_LIBVER_LATEST)) { - h5badArgument(env, "H5Pset_libver_bounds: invalid low library version bound"); - } /* end else if */ - else { - retVal = H5Pset_libver_bounds((hid_t)fapl_id, (H5F_libver_t)low, (H5F_libver_t)high); - if(retVal < 0) - h5libraryError(env); - } /* end else */ + retVal = H5Pset_libver_bounds((hid_t)fapl_id, (H5F_libver_t)low, (H5F_libver_t)high); + if(retVal < 0) + h5libraryError(env); return (jint)retVal; } /* end Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds */ -- cgit v0.12 From 3f221c1347fbce0342f7e726bf00fe577d7c4422 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 15 Mar 2018 14:11:15 -0500 Subject: Correct constant var names --- java/src/jni/h5Constants.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index fbbd332..900316e 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -380,15 +380,15 @@ Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1STRONG(JNIEnv *env, jclass cls) { ret JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1WEAK(JNIEnv *env, jclass cls) { return H5F_CLOSE_WEAK; } JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1EARLIEST(JNIEnv *env, jclass cls){return H5F_LIBVER_ERROR;} +Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1ERROR(JNIEnv *env, jclass cls){return H5F_LIBVER_ERROR;} JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1EARLIEST(JNIEnv *env, jclass cls){return H5F_LIBVER_EARLIEST;} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1EARLIEST(JNIEnv *env, jclass cls){return H5F_LIBVER_V18;} +Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V18(JNIEnv *env, jclass cls){return H5F_LIBVER_V18;} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1EARLIEST(JNIEnv *env, jclass cls){return H5F_LIBVER_V110;} +Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V110(JNIEnv *env, jclass cls){return H5F_LIBVER_V110;} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1EARLIEST(JNIEnv *env, jclass cls){return H5F_LIBVER_NBOUNDS;} +Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1NBOUNDS(JNIEnv *env, jclass cls){return H5F_LIBVER_NBOUNDS;} JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1LATEST(JNIEnv *env, jclass cls){return H5F_LIBVER_LATEST;} JNIEXPORT jint JNICALL -- cgit v0.12 From 692c7867ef243bfbf28c2064e6b3c09070c29175 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 15 Mar 2018 14:14:29 -0500 Subject: Exception type changed --- java/test/TestH5P.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java index 9e45e4c..cfe7c33 100644 --- a/java/test/TestH5P.java +++ b/java/test/TestH5P.java @@ -211,7 +211,7 @@ public class TestH5P { H5.H5Pset_libver_bounds(fapl_id, 5, HDF5Constants.H5F_LIBVER_LATEST); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = HDF5FunctionArgumentException.class) public void testH5Pset_libver_bounds_invalidhigh() throws Throwable { H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, 5); } -- cgit v0.12 From fe22bb8e44b89468849f5a70f014215a459c9d5b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 15 Mar 2018 14:15:45 -0500 Subject: Exception changed --- java/test/TestH5P.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java index cfe7c33..f713063 100644 --- a/java/test/TestH5P.java +++ b/java/test/TestH5P.java @@ -206,7 +206,7 @@ public class TestH5P { assertEquals(nlinks, 20L); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = HDF5FunctionArgumentException.class) public void testH5Pset_libver_bounds_invalidlow() throws Throwable { H5.H5Pset_libver_bounds(fapl_id, 5, HDF5Constants.H5F_LIBVER_LATEST); } -- cgit v0.12 From b2d739ef39633ed688ce855fba72aa3ddcbaf43d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 15 Mar 2018 14:28:36 -0500 Subject: Chnage values so test will fail when new latest is added --- java/test/TestH5P.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java index f713063..d69403c 100644 --- a/java/test/TestH5P.java +++ b/java/test/TestH5P.java @@ -213,7 +213,7 @@ public class TestH5P { @Test(expected = HDF5FunctionArgumentException.class) public void testH5Pset_libver_bounds_invalidhigh() throws Throwable { - H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, 5); + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_V110, HDF5Constants.H5F_LIBVER_LATEST+1); } @Test -- cgit v0.12 From 57e468aba7ba66bba1f9a1736450ed4295a6c25d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 15 Mar 2018 14:35:03 -0500 Subject: Change max value --- java/test/TestH5P.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java index d69403c..521a53c 100644 --- a/java/test/TestH5P.java +++ b/java/test/TestH5P.java @@ -213,7 +213,7 @@ public class TestH5P { @Test(expected = HDF5FunctionArgumentException.class) public void testH5Pset_libver_bounds_invalidhigh() throws Throwable { - H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_V110, HDF5Constants.H5F_LIBVER_LATEST+1); + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_V110, HDF5Constants.H5F_LIBVER_V110+1); } @Test -- cgit v0.12