diff options
-rw-r--r-- | java/src/jni/h5pImp.c | 14 | ||||
-rw-r--r-- | java/test/TestH5P.java | 5 |
2 files changed, 7 insertions, 12 deletions
diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index d542902..ab39739 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -2965,16 +2965,10 @@ Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags(JNIEnv *env, jclass clss, jlong la { herr_t retVal = -1; - if (((unsigned) flags != H5F_ACC_RDWR) && - ((unsigned) flags != H5F_ACC_RDONLY) && - ((unsigned) flags != H5F_ACC_DEFAULT)) { - h5badArgument(env, "H5Pset_elink_acc_flags: invalid flags value"); - } /* end if */ - else { - retVal = H5Pset_elink_acc_flags((hid_t)lapl_id, (unsigned)flags); - if (retVal < 0) - h5libraryError(env); - } /* end else */ + retVal = H5Pset_elink_acc_flags((hid_t)lapl_id, (unsigned)flags); + if (retVal < 0) + h5libraryError(env); + return (jint) retVal; } /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags */ diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java index 2a0fc34..b8a4376 100644 --- a/java/test/TestH5P.java +++ b/java/test/TestH5P.java @@ -25,6 +25,7 @@ import java.io.File; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException; import hdf.hdf5lib.exceptions.HDF5LibraryException; import org.junit.After; @@ -496,12 +497,12 @@ public class TestH5P { assertEquals(HDF5Constants.H5F_ACC_RDWR, get_flags); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = HDF5FunctionArgumentException.class) public void testH5Pset_elink_acc_flags_InvalidFlag1() throws Throwable { H5.H5Pset_elink_acc_flags(lapl_id, HDF5Constants.H5F_ACC_TRUNC); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = HDF5FunctionArgumentException.class) public void testH5Pset_elink_acc_flags_InvalidFlag2() throws Throwable { H5.H5Pset_elink_acc_flags(lapl_id, -1); } |