diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2016-03-16 17:45:59 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2016-03-16 17:45:59 (GMT) |
commit | e06b457e88de84c22a0fe9bc712d20b5fbf537b2 (patch) | |
tree | 92c3223b3374e497b90a14aa8c67c0ec806e585d /java | |
parent | 19e8a6e0079676ce1188134abc4ad9dc6c892c60 (diff) | |
download | hdf5-e06b457e88de84c22a0fe9bc712d20b5fbf537b2.zip hdf5-e06b457e88de84c22a0fe9bc712d20b5fbf537b2.tar.gz hdf5-e06b457e88de84c22a0fe9bc712d20b5fbf537b2.tar.bz2 |
[svn-r29452] Correct signature of H5Pexist to return boolean and fix test compare
Diffstat (limited to 'java')
-rw-r--r-- | java/src/hdf/hdf5lib/H5.java | 5 | ||||
-rw-r--r-- | java/src/jni/h5pImp.c | 14 | ||||
-rw-r--r-- | java/src/jni/h5pImp.h | 4 | ||||
-rw-r--r-- | java/test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | java/test/JUnit-interface.ert | 2 | ||||
-rw-r--r-- | java/test/JUnit-interface.txt | 2 | ||||
-rw-r--r-- | java/test/TestH5Plist.java | 20 | ||||
-rw-r--r-- | java/test/junit.sh.in | 1 |
8 files changed, 26 insertions, 24 deletions
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 8621cb3..7a14f8c 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -4415,13 +4415,12 @@ public class H5 implements java.io.Serializable { * IN: Identifier for the property to query * @param name * IN: Name of property to check for - * @return a positive value if the property exists in the property object; zero if the property does not exist; a - * negative value if failed + * @return a true value if the property exists in the property object; false if the property does not exist; * * @exception HDF5LibraryException * - Error from the HDF-5 Library. */ - public synchronized static native int H5Pexist(long plid, String name) throws HDF5LibraryException; + public synchronized static native boolean H5Pexist(long plid, String name) throws HDF5LibraryException; /** * H5Pget_size retrieves the size of a property's value in bytes diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index eb83bb0..8ecd81c 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -2162,24 +2162,26 @@ Java_hdf_hdf5lib_H5_H5Pset(JNIEnv *env, jclass clss, jlong plid, jstring name, j /* * Class: hdf_hdf5lib_H5 * Method: H5Pexist - * Signature: (JLjava/lang/String;)J + * Signature: (JLjava/lang/String;)Z */ -JNIEXPORT jlong JNICALL +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pexist(JNIEnv *env, jclass clss, jlong plid, jstring name) { - hid_t retVal = -1; + htri_t bval = JNI_FALSE; const char *cstr; PIN_JAVA_STRING(name, cstr, -1); - retVal = H5Pexist((hid_t)plid, cstr); + bval = H5Pexist((hid_t)plid, cstr); UNPIN_JAVA_STRING(name, cstr); - if (retVal < 0) + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) h5libraryError(env); - return (jlong)retVal; + return (jboolean)bval; } /* end Java_hdf_hdf5lib_H5_H5Pexist */ /* diff --git a/java/src/jni/h5pImp.h b/java/src/jni/h5pImp.h index 22c817e..a06a64f 100644 --- a/java/src/jni/h5pImp.h +++ b/java/src/jni/h5pImp.h @@ -579,9 +579,9 @@ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pset /* * Class: hdf_hdf5lib_H5 * Method: H5Pexist - * Signature: (JLjava/lang/String;)J + * Signature: (JLjava/lang/String;)Z */ -JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pexist +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pexist (JNIEnv *, jclass, jlong, jstring); /* diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index 949eb05..e45e081 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -66,6 +66,7 @@ set_target_properties (${HDF5_JAVA_TEST_LIB_TARGET} PROPERTIES FOLDER test/java) set (HDF_JAVA_TEST_FILES h5ex_g_iterate.hdf JUnit-interface.txt + JUnit-interface.ert ) foreach (h5_file ${HDF_JAVA_TEST_FILES}) @@ -106,6 +107,7 @@ add_test ( -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -D "TEST_FOLDER=${HDF5_BINARY_DIR}/java/test" -D "TEST_OUTPUT=JUnit-interface.out" + -D "TEST_ERRREF=JUnit-interface.ert" # -D "TEST_LOG_LEVEL=trace" -D "TEST_EXPECT=0" -D "TEST_MASK_ERROR=TRUE" diff --git a/java/test/JUnit-interface.ert b/java/test/JUnit-interface.ert new file mode 100644 index 0000000..5771a4f --- /dev/null +++ b/java/test/JUnit-interface.ert @@ -0,0 +1,2 @@ +[main] INFO hdf.hdf5lib.H5 - HDF5 library: hdf5_java +[main] INFO hdf.hdf5lib.H5 - successfully loaded from java.library.path diff --git a/java/test/JUnit-interface.txt b/java/test/JUnit-interface.txt index 5847198..d7cd29d 100644 --- a/java/test/JUnit-interface.txt +++ b/java/test/JUnit-interface.txt @@ -650,5 +650,3 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #002: (file name) line (number) in H5P_isa_class(): not a property list major: Invalid arguments to routine minor: Inappropriate type -[main] INFO hdf.hdf5lib.H5 - HDF5 library: hdf5_java -[main] INFO hdf.hdf5lib.H5 - successfully loaded from java.library.path diff --git a/java/test/TestH5Plist.java b/java/test/TestH5Plist.java index c4dee01..024237a 100644 --- a/java/test/TestH5Plist.java +++ b/java/test/TestH5Plist.java @@ -284,7 +284,7 @@ public class TestH5Plist { // Test basic generic property list code. Tests adding properties to generic classes. @Test public void testH5P_genprop_basic_class_prop() { - int status = -1; + boolean status = false; long size = -1; // Generic Property size long nprops = -1; // Generic Property class number @@ -306,7 +306,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist plist_class_id "+PROP1_NAME, status == 0); + assertFalse("H5Pexist plist_class_id "+PROP1_NAME, status); // Insert first property into class (with no callbacks) try { @@ -337,7 +337,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist plist_class_id "+PROP1_NAME, status == 1); + assertTrue("H5Pexist plist_class_id "+PROP1_NAME, status); // Check the size of the first property try { @@ -388,7 +388,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist plist_class_id "+PROP2_NAME, status == 1); + assertTrue("H5Pexist plist_class_id "+PROP2_NAME, status); // Check the size of the second property try { @@ -429,7 +429,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist plist_class_id "+PROP3_NAME, status == 1); + assertTrue("H5Pexist plist_class_id "+PROP3_NAME, status); // Check the size of the third property try { @@ -635,7 +635,7 @@ public class TestH5Plist { // removing properties from them. @Test public void testH5P_genprop_basic_list_prop() { - int status = -1; + boolean status = false; long lid1 = -1; // Generic Property list ID long nprops = -1; // Number of properties in class @@ -725,7 +725,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist lid1 "+PROP1_NAME, status == 1); + assertTrue("H5Pexist lid1 "+PROP1_NAME, status); try { status = H5.H5Pexist(lid1, PROP2_NAME); } @@ -733,7 +733,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist lid1 "+PROP2_NAME, status == 1); + assertTrue("H5Pexist lid1 "+PROP2_NAME, status); try { status = H5.H5Pexist(lid1, PROP3_NAME); } @@ -741,7 +741,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist lid1 "+PROP3_NAME, status == 1); + assertTrue("H5Pexist lid1 "+PROP3_NAME, status); try { status = H5.H5Pexist(lid1, PROP4_NAME); } @@ -749,7 +749,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist lid1 "+PROP4_NAME, status == 1); + assertTrue("H5Pexist lid1 "+PROP4_NAME, status); } finally { diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index c05e502..94b3415 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -237,7 +237,6 @@ sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ $actual_ext > $actual -cat $actual_err >> $actual if $CMP $expect $actual; then echo " PASSED" |