diff options
author | Jordan Henderson <jhenderson@hdfgroup.org> | 2019-02-12 17:41:55 (GMT) |
---|---|---|
committer | Jordan Henderson <jhenderson@hdfgroup.org> | 2019-02-12 17:56:42 (GMT) |
commit | 3acd486b83f319579b1c6884c90289b0eb1d44a6 (patch) | |
tree | f4b0093c1915d2fbd704ea1948b80ba089ab82f5 /java | |
parent | 8f42566f7ac087504c115c7d98b79c56604c2ebe (diff) | |
download | hdf5-3acd486b83f319579b1c6884c90289b0eb1d44a6.zip hdf5-3acd486b83f319579b1c6884c90289b0eb1d44a6.tar.gz hdf5-3acd486b83f319579b1c6884c90289b0eb1d44a6.tar.bz2 |
Fixes for JNI updates
Diffstat (limited to 'java')
-rw-r--r-- | java/src/jni/h5aImp.c | 63 | ||||
-rw-r--r-- | java/src/jni/h5dImp.c | 12 | ||||
-rw-r--r-- | java/src/jni/h5eImp.c | 23 | ||||
-rw-r--r-- | java/src/jni/h5fImp.c | 18 | ||||
-rw-r--r-- | java/src/jni/h5gImp.c | 12 | ||||
-rw-r--r-- | java/src/jni/h5lImp.c | 55 | ||||
-rw-r--r-- | java/src/jni/h5oImp.c | 31 | ||||
-rw-r--r-- | java/src/jni/h5pDAPLImp.c | 3 | ||||
-rw-r--r-- | java/src/jni/h5pDCPLImp.c | 15 | ||||
-rw-r--r-- | java/src/jni/h5pDXPLImp.c | 3 | ||||
-rw-r--r-- | java/src/jni/h5pFAPLImp.c | 41 | ||||
-rw-r--r-- | java/src/jni/h5pImp.c | 39 | ||||
-rw-r--r-- | java/src/jni/h5pLAPLImp.c | 3 | ||||
-rw-r--r-- | java/src/jni/h5plImp.c | 12 | ||||
-rw-r--r-- | java/src/jni/h5rImp.c | 2 | ||||
-rw-r--r-- | java/src/jni/h5sImp.c | 2 | ||||
-rw-r--r-- | java/src/jni/h5tImp.c | 39 | ||||
-rw-r--r-- | java/src/jni/h5util.c | 18 | ||||
-rw-r--r-- | java/src/jni/h5vlImp.c | 9 | ||||
-rw-r--r-- | java/test/TestH5Edefault.java | 2 | ||||
-rw-r--r-- | java/test/TestH5Oparams.java | 4 | ||||
-rw-r--r-- | java/test/TestH5Sbasic.java | 2 |
22 files changed, 373 insertions, 35 deletions
diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c index 666626f..e47515d 100644 --- a/java/src/jni/h5aImp.c +++ b/java/src/jni/h5aImp.c @@ -1533,6 +1533,9 @@ Java_hdf_hdf5lib_H5_H5Adelete UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Adelete: attribute name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, attrName, NULL, "H5Adelete: attribute name not pinned"); if ((status = H5Adelete((hid_t)loc_id, attrName)) < 0) @@ -1580,6 +1583,9 @@ Java_hdf_hdf5lib_H5__1H5Acreate2 UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Acreate2: attribute name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, attrName, NULL, "H5Acreate2: attribute name not pinned"); if ((status = H5Acreate2((hid_t)loc_id, attrName, (hid_t)type_id, @@ -1608,6 +1614,9 @@ Java_hdf_hdf5lib_H5__1H5Aopen UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aopen: attribute name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, attrName, NULL, "H5Aopen: attribute name not pinned"); if ((retVal = H5Aopen((hid_t)obj_id, attrName, (hid_t)access_plist)) < 0) @@ -1634,6 +1643,9 @@ Java_hdf_hdf5lib_H5__1H5Aopen_1by_1idx UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aopen_by_idx: object name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Aopen_by_idx: object name not pinned"); if ((retVal = H5Aopen_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type, @@ -1662,6 +1674,11 @@ Java_hdf_hdf5lib_H5__1H5Acreate_1by_1name UNUSED(clss); + if (NULL == obj_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Acreate_by_name: object name is NULL"); + if (NULL == attr_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Acreate_by_name: attribute name is NULL"); + PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Acreate_by_name: object name not pinned"); PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Acreate_by_name: attribute name not pinned"); @@ -1693,6 +1710,11 @@ Java_hdf_hdf5lib_H5_H5Aexists_1by_1name UNUSED(clss); + if (NULL == obj_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aexists_by_name: object name is NULL"); + if (NULL == attr_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aexists_by_name: attribute name is NULL"); + PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Aexists_by_name: object name not pinned"); PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Aexists_by_name: attribute name not pinned"); @@ -1725,6 +1747,11 @@ Java_hdf_hdf5lib_H5_H5Arename UNUSED(clss); + if (NULL == old_attr_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Arename: old attribute name is NULL"); + if (NULL == new_attr_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Arename: new attribute name is NULL"); + PIN_JAVA_STRING(ENVONLY, old_attr_name, oldAttrName, NULL, "H5Arename: old attribute name not pinned"); PIN_JAVA_STRING(ENVONLY, new_attr_name, newAttrName, NULL, "H5Arename: new attribute name not pinned"); @@ -1756,6 +1783,13 @@ Java_hdf_hdf5lib_H5_H5Arename_1by_1name UNUSED(clss); + if (NULL == obj_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Arename_by_name: object name is NULL"); + if (NULL == old_attr_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Arename_by_name: old attribute name is NULL"); + if (NULL == new_attr_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Arename_by_name: new attribute name is NULL"); + PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Arename_by_name: object name not pinned"); PIN_JAVA_STRING(ENVONLY, old_attr_name, oldAttrName, NULL, "H5Arename_by_name: old attribute name not pinned"); PIN_JAVA_STRING(ENVONLY, new_attr_name, newAttrName, NULL, "H5Arename_by_name: new attribute name not pinned"); @@ -1790,6 +1824,9 @@ Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx UNUSED(clss); + if (NULL == obj_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aget_name_by_idx: object name is NULL"); + PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Aget_name_by_idx: object name not pinned"); /* Get the length of the attribute name */ @@ -1883,6 +1920,9 @@ Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1idx UNUSED(clss); + if (NULL == obj_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aget_info_by_idx: object name is NULL"); + PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Aget_info_by_idx: object name not pinned"); if ((status = H5Aget_info_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type, @@ -1921,6 +1961,11 @@ Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1name UNUSED(clss); + if (NULL == obj_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aget_info_by_name: object name is NULL"); + if (NULL == attr_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aget_info_by_name: attribute name is NULL"); + PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Aget_info_by_name: object name not pinned"); PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Aget_info_by_name: attribute name not pinned"); @@ -1958,6 +2003,11 @@ Java_hdf_hdf5lib_H5_H5Adelete_1by_1name UNUSED(clss); + if (NULL == obj_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Adelete_by_name: object name is NULL"); + if (NULL == attr_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Adelete_by_name: attribute name is NULL"); + PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Adelete_by_name: object name not pinned"); PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Adelete_by_name: attribute name not pinned"); @@ -1987,6 +2037,9 @@ Java_hdf_hdf5lib_H5_H5Aexists UNUSED(clss); + if (NULL == attr_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aexists: attribute name is NULL"); + PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Aexists: attribute name not pinned"); if ((bval = H5Aexists((hid_t)obj_id, attrName)) < 0) @@ -2015,6 +2068,9 @@ Java_hdf_hdf5lib_H5_H5Adelete_1by_1idx UNUSED(clss); + if (NULL == obj_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Adelete_by_idx: object name is NULL"); + PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Adelete_by_idx: object name not pinned"); if ((status = H5Adelete_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t)n, (hid_t)lapl_id)) < 0) @@ -2041,6 +2097,11 @@ Java_hdf_hdf5lib_H5__1H5Aopen_1by_1name UNUSED(clss); + if (NULL == obj_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aopen_by_name: object name is NULL"); + if (NULL == attr_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aopen_by_name: attribute name is NULL"); + PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Aopen_by_name: object name not pinned"); PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Aopen_by_name: attribute name not pinned"); @@ -2187,6 +2248,8 @@ Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aiterate_by_name: op_data is NULL"); if (NULL == callback_op) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aiterate_by_name: callback_op is NULL"); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aiterate_by_name: object name is NULL"); PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Aiterate_by_name: object name not pinned"); diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c index 0ed3b6e..92a3723 100644 --- a/java/src/jni/h5dImp.c +++ b/java/src/jni/h5dImp.c @@ -69,6 +69,9 @@ Java_hdf_hdf5lib_H5__1H5Dcreate UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dcreate: dataset name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, dsetName, NULL, "H5Dcreate: dataset name not pinned"); if ((dset_id = H5Dcreate2((hid_t)loc_id, dsetName, (hid_t)type_id, (hid_t)space_id, H5P_DEFAULT, (hid_t)create_plist_id, H5P_DEFAULT)) < 0) @@ -95,6 +98,9 @@ Java_hdf_hdf5lib_H5__1H5Dopen UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dopen: dataset name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, dsetName, NULL, "H5Dopen: dataset name not pinned"); if ((dset_id = H5Dopen2((hid_t)loc_id, dsetName, H5P_DEFAULT))) @@ -1677,6 +1683,9 @@ Java_hdf_hdf5lib_H5__1H5Dcreate2 UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dcreate2: dataset name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, dsetName, NULL, "H5Dcreate2: dataset name not pinned"); if ((dset_id = H5Dcreate2((hid_t)loc_id, dsetName, (hid_t)type_id, (hid_t)space_id, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id)) < 0) @@ -1703,6 +1712,9 @@ Java_hdf_hdf5lib_H5__1H5Dopen2 UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dopen2: dataset name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, dsetName, NULL, "H5Dopen2: dataset name not pinned"); if ((dset_id = H5Dopen2((hid_t)loc_id, dsetName, (hid_t)access_plist)) < 0) diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c index 1c5a5a9..4ab00df 100644 --- a/java/src/jni/h5eImp.c +++ b/java/src/jni/h5eImp.c @@ -94,6 +94,13 @@ Java_hdf_hdf5lib_H5_H5Eregister_1class UNUSED(cls); + if (NULL == cls_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Eregister_class: class name is NULL"); + if (NULL == lib_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Eregister_class: lib name is NULL"); + if (NULL == version) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Eregister_class: version string is NULL"); + PIN_JAVA_STRING(ENVONLY, cls_name, the_cls_name, NULL, "H5Eregister_class: class name not pinned"); PIN_JAVA_STRING(ENVONLY, lib_name, the_lib_name, NULL, "H5Eregister_class: lib name not pinned"); PIN_JAVA_STRING(ENVONLY, version, the_version, NULL, "H5Eregister_class: version string not pinned"); @@ -171,6 +178,8 @@ Java_hdf_hdf5lib_H5_H5Ecreate_1msg if (err_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Ecreate_msg: invalid error class ID"); + if (NULL == err_msg) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ecreate_msg: error message string is NULL"); PIN_JAVA_STRING(ENVONLY, err_msg, the_err_msg, NULL, "H5Ecreate_msg: error message string not pinned"); @@ -376,13 +385,19 @@ Java_hdf_hdf5lib_H5_H5Epush2 UNUSED(cls); if (stk_id < 0) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush: invalid error stack ID"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush2: invalid error stack ID"); if (class_id < 0) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush: invalid error class ID"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush2: invalid error class ID"); if (major_id < 0) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush: invalid major error class ID"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush2: invalid major error class ID"); if (minor_id < 0) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush: invalid minor error class ID"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush2: invalid minor error class ID"); + if (NULL == filename) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Epush2: filename is NULL"); + if (NULL == funcname) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Epush2: function name is NULL"); + if (NULL == err_desc) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Epush2: error message is NULL"); PIN_JAVA_STRING(ENVONLY, filename, fName, NULL, "H5Epush2: filename not pinned"); PIN_JAVA_STRING(ENVONLY, funcname, fncName, NULL, "H5Epush2: function name not pinned"); diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c index 624c788..d145c6a 100644 --- a/java/src/jni/h5fImp.c +++ b/java/src/jni/h5fImp.c @@ -47,6 +47,9 @@ Java_hdf_hdf5lib_H5__1H5Fopen UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fopen: file name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Fopen: file name not pinned"); if ((status = H5Fopen(fileName, (unsigned)flags, (hid_t)access_id)) < 0) @@ -73,6 +76,9 @@ Java_hdf_hdf5lib_H5__1H5Fcreate UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fcreate: file name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Fcreate: file name not pinned"); if ((status = H5Fcreate(fileName, (unsigned)flags, create_id, access_id)) < 0) @@ -159,6 +165,9 @@ Java_hdf_hdf5lib_H5_H5Fis_1hdf5 H5_UNIMPLEMENTED(ENVONLY, "H5Fis_hdf5: not implemented"); #endif + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fis_hdf5: file name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Fis_hdf5: file name not pinned"); if ((bval = H5Fis_hdf5(fileName)) < 0) @@ -187,6 +196,9 @@ Java_hdf_hdf5lib_H5_H5Fis_1accessible UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fis_accessible: file name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Fis_accessible: file name not pinned"); if ((bval = H5Fis_accessible(fileName, (hid_t)file_id)) < 0) @@ -295,6 +307,9 @@ Java_hdf_hdf5lib_H5_H5Fmount UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fmount: file name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Fmount: file name not pinned"); if ((status = H5Fmount((hid_t)loc_id, fileName, (hid_t)child_id, (hid_t)plist_id)) < 0) @@ -321,6 +336,9 @@ Java_hdf_hdf5lib_H5_H5Funmount UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Funmount: file name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Funmount: file name not pinned"); if ((status = H5Funmount((hid_t)loc_id, fileName)) < 0) diff --git a/java/src/jni/h5gImp.c b/java/src/jni/h5gImp.c index 8adabca..b579f31 100644 --- a/java/src/jni/h5gImp.c +++ b/java/src/jni/h5gImp.c @@ -126,6 +126,9 @@ Java_hdf_hdf5lib_H5__1H5Gcreate2 UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gcreate2: group name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Gcreate2: group name not pinned"); if ((group_id = H5Gcreate2((hid_t)loc_id, grpName, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id)) < 0) @@ -172,6 +175,9 @@ Java_hdf_hdf5lib_H5__1H5Gopen2 UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gopen2: group name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Gopen2: group name not pinned"); if ((group_id = H5Gopen2((hid_t)loc_id, grpName, (hid_t)access_plist_id)) < 0) @@ -245,6 +251,9 @@ Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name UNUSED(cls); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_info_by_name: group name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Gget_info_by_name: group name not pinned"); if ((ret_val = H5Gget_info_by_name((hid_t)loc_id, grpName, &group_info, (hid_t)lapl_id)) < 0) @@ -281,6 +290,9 @@ Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx UNUSED(cls); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_info_by_idx: group name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Gget_info_by_idx: group name not pinned"); if ((ret_val = H5Gget_info_by_idx((hid_t)loc_id, grpName, cindex_type, diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c index 5999270..af6c8ba 100644 --- a/java/src/jni/h5lImp.c +++ b/java/src/jni/h5lImp.c @@ -59,6 +59,11 @@ Java_hdf_hdf5lib_H5_H5Lcopy UNUSED(clss); + if (NULL == cur_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcopy: src name is NULL"); + if (NULL == dst_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcopy: dest name is NULL"); + PIN_JAVA_STRING(ENVONLY, cur_name, lCurName, NULL, "H5Lcopy: src name not pinned"); PIN_JAVA_STRING(ENVONLY, dst_name, lDstName, NULL, "H5Lcopy: dest name not pinned"); @@ -89,6 +94,13 @@ Java_hdf_hdf5lib_H5_H5Lcreate_1external UNUSED(clss); + if (NULL == file_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_external: file name is NULL"); + if (NULL == cur_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_external: object name is NULL"); + if (NULL == dst_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_external: link name is NULL"); + PIN_JAVA_STRING(ENVONLY, file_name, lFileName, NULL, "H5Lcreate_external: file name not pinned"); PIN_JAVA_STRING(ENVONLY, cur_name, lCurName, NULL, "H5Lcreate_external: object name not pinned"); PIN_JAVA_STRING(ENVONLY, dst_name, lDstName, NULL, "H5Lcreate_external: link name not pinned"); @@ -121,6 +133,11 @@ Java_hdf_hdf5lib_H5_H5Lcreate_1hard UNUSED(clss); + if (NULL == cur_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_hard: object name is NULL"); + if (NULL == dst_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_hard: link name is NULL"); + PIN_JAVA_STRING(ENVONLY, cur_name, lCurName, NULL, "H5Lcreate_hard: object name not pinned"); PIN_JAVA_STRING(ENVONLY, dst_name, lDstName, NULL, "H5Lcreate_hard: link name not pinned"); @@ -150,6 +167,11 @@ Java_hdf_hdf5lib_H5_H5Lcreate_1soft UNUSED(clss); + if (NULL == cur_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_soft: link target is NULL"); + if (NULL == dst_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_soft: link name is NULL"); + PIN_JAVA_STRING(ENVONLY, cur_name, linkTarget, NULL, "H5Lcreate_soft: link target not pinned"); PIN_JAVA_STRING(ENVONLY, dst_name, linkName, NULL, "H5Lcreate_soft: link name not pinned"); @@ -177,6 +199,9 @@ Java_hdf_hdf5lib_H5_H5Ldelete UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ldelete: link name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, linkName, NULL, "H5Ldelete: link name not pinned"); if ((status = H5Ldelete((hid_t)loc_id, linkName, (hid_t)access_id)) < 0) @@ -203,6 +228,9 @@ Java_hdf_hdf5lib_H5_H5Ldelete_1by_1idx UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ldelete_by_idx: group name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, groupName, NULL, "H5Ldelete_by_idx: group name not pinned"); if ((status = H5Ldelete_by_idx((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order, n, (hid_t)access_id)) < 0) @@ -227,6 +255,9 @@ Java_hdf_hdf5lib_H5_H5Lexists UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lexists: link name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, linkName, NULL, "H5Lexists: link name not pinned"); if ((bval = H5Lexists((hid_t)loc_id, linkName, (hid_t)access_id)) < 0) @@ -258,6 +289,9 @@ Java_hdf_hdf5lib_H5_H5Lget_1info UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lget_info: link name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, linkName, NULL, "H5Lget_info: link name not pinned"); if ((status = H5Lget_info((hid_t)loc_id, linkName, &infobuf, (hid_t)access_id)) < 0) @@ -296,6 +330,9 @@ Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lget_info_by_idx: group name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, groupName, NULL, "H5Lget_info_by_idx: group name not pinned"); if ((status = H5Lget_info_by_idx((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id)) < 0) @@ -333,6 +370,9 @@ Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lget_name_by_idx: group name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, groupName, NULL, "H5Lget_name_by_idx: group name not pinned"); /* Get the length of the link name */ @@ -378,6 +418,9 @@ Java_hdf_hdf5lib_H5_H5Lget_1value UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lget_value: link name is NULL"); + infobuf.type = H5L_TYPE_ERROR; PIN_JAVA_STRING(ENVONLY, name, linkName, NULL, "H5Lget_value: link name not pinned"); @@ -465,6 +508,9 @@ Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lget_val_by_idx: group name is NULL"); + infobuf.type = H5L_TYPE_ERROR; PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Lget_val_by_idx: group name not pinned"); @@ -551,6 +597,11 @@ Java_hdf_hdf5lib_H5_H5Lmove UNUSED(clss); + if (NULL == cur_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lmove: src name is NULL"); + if (NULL == dst_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lmove: dest name is NULL"); + PIN_JAVA_STRING(ENVONLY, cur_name, lCurName, NULL, "H5Lmove: src name not pinned"); PIN_JAVA_STRING(ENVONLY, dst_name, lDstName, NULL, "H5Lmove: dest name not pinned"); @@ -675,6 +726,8 @@ Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lvisit_by_name: op_data is NULL"); if (NULL == callback_op) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lvisit_by_name: callback_op is NULL"); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lvisit_by_name: group name is NULL"); PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Lvisit_by_name: group name not pinned"); @@ -743,6 +796,8 @@ Java_hdf_hdf5lib_H5_H5Literate_1by_1name H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Literate_by_name: op_data is NULL"); if (NULL == callback_op) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Literate_by_name: callback_op is NULL"); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Literate_by_name: group name is NULL"); PIN_JAVA_STRING(ENVONLY, name, groupName, NULL, "H5Literate_by_name: group name not pinned"); diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c index 0b1a984..cc88b81 100644 --- a/java/src/jni/h5oImp.c +++ b/java/src/jni/h5oImp.c @@ -56,6 +56,9 @@ Java_hdf_hdf5lib_H5__1H5Oopen UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oopen: object name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oopen: object name not pinned"); if ((status = H5Oopen((hid_t)loc_id, objName, (hid_t)access_plist_id)) < 0) @@ -104,6 +107,11 @@ Java_hdf_hdf5lib_H5_H5Ocopy UNUSED(clss); + if (NULL == cur_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ocopy: src name is NULL"); + if (NULL == dst_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ocopy: dst name is NULL"); + PIN_JAVA_STRING(ENVONLY, cur_name, lCurName, NULL, "H5Ocopy: src name not pinned"); PIN_JAVA_STRING(ENVONLY, dst_name, lDstName, NULL, "H5Ocopy: dest name not pinned"); @@ -204,6 +212,9 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oget_info_by_name: object name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oget_info_by_name: object name not pinned"); if ((status = H5Oget_info_by_name2((hid_t)loc_id, objName, &infobuf, (unsigned)fields, (hid_t)access_id)) < 0) @@ -278,6 +289,9 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oget_info_by_idx: group name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Oget_info_by_idx: group name not pinned"); if ((status = H5Oget_info_by_idx2((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (unsigned)fields, (hid_t)access_id)) < 0) @@ -346,6 +360,9 @@ Java_hdf_hdf5lib_H5_H5Olink UNUSED(clss); + if (NULL == dst_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Olink: link destination name is NULL"); + PIN_JAVA_STRING(ENVONLY, dst_name, linkDstName, NULL, "H5Olink: link destination name not pinned"); if ((status = H5Olink((hid_t)cur_loc_id, (hid_t)dst_loc_id, linkDstName, (hid_t)create_id, (hid_t)access_id)) < 0) @@ -525,6 +542,8 @@ Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ovisit_by_name: op_data is NULL"); if (NULL == callback_op) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ovisit_by_name: callback_op is NULL"); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ovisit_by_name: object name is NULL"); PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Ovisit_by_name: object name not pinned"); @@ -580,6 +599,9 @@ Java_hdf_hdf5lib_H5_H5Oset_1comment_1by_1name UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oset_comment_by_name: object name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oset_comment_by_name: object name not pinned"); if (NULL != comment) @@ -651,6 +673,9 @@ Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oget_comment_by_name: object name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oget_comment_by_name: object name not pinned"); /* Get the length of the comment */ @@ -692,6 +717,9 @@ Java_hdf_hdf5lib_H5_H5Oexists_1by_1name UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oexists_by_name: object name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oexists_by_name: object name not pinned"); if ((bval = H5Oexists_by_name((hid_t)loc_id, objName, (hid_t)access_id)) < 0) @@ -777,6 +805,9 @@ Java_hdf_hdf5lib_H5__1H5Oopen_1by_1idx UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oopen_by_idx: object name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Oopen_by_idx: object name not pinned"); if ((retVal = H5Oopen_by_idx((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (hid_t)lapl_id)) < 0) diff --git a/java/src/jni/h5pDAPLImp.c b/java/src/jni/h5pDAPLImp.c index 0afbbd6..fb39b84 100644 --- a/java/src/jni/h5pDAPLImp.c +++ b/java/src/jni/h5pDAPLImp.c @@ -119,6 +119,9 @@ Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix UNUSED(clss); + if (NULL == prefix) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_efile_prefix: external file prefix is NULL"); + PIN_JAVA_STRING(ENVONLY, prefix, extFilePrefix, NULL, "H5Pset_efile_prefix: external file prefix not pinned"); if ((retVal = H5Pset_efile_prefix((hid_t)dapl_id, extFilePrefix)) < 0) diff --git a/java/src/jni/h5pDCPLImp.c b/java/src/jni/h5pDCPLImp.c index 0671843..7559c3b 100644 --- a/java/src/jni/h5pDCPLImp.c +++ b/java/src/jni/h5pDCPLImp.c @@ -1008,8 +1008,8 @@ Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset UNUSED(clss); - if (scale_factor <= 0) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_scaleoffset: scale factor must be > 0"); + if (scale_factor < 0) + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_scaleoffset: scale factor must be >= 0"); if (scale_type != H5Z_SO_FLOAT_DSCALE && scale_type != H5Z_SO_FLOAT_ESCALE && scale_type != H5Z_SO_INT) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_scaleoffset: invalid scale type"); @@ -1074,6 +1074,9 @@ Java_hdf_hdf5lib_H5_H5Pset_1external UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_external: file name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Pset_external: file name not pinned"); if ((status = H5Pset_external((hid_t)plist, fileName, (off_t)offset, (hsize_t)size)) < 0) @@ -1189,6 +1192,11 @@ Java_hdf_hdf5lib_H5_H5Pset_1virtual UNUSED(clss); + if (NULL == src_file_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_virtual: src_file_name is NULL"); + if (NULL == src_dset_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_virtual: src_dset_name is NULL"); + PIN_JAVA_STRING(ENVONLY, src_file_name, fstr, NULL, "H5Pset_virtual: src_file_name not pinned"); PIN_JAVA_STRING(ENVONLY, src_dset_name, dstr, NULL, "H5Pset_virtual: src_dset_name not pinned"); @@ -1352,6 +1360,9 @@ Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix UNUSED(clss); + if (NULL == prefix) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_virtual_prefix: virtual prefix is NULL"); + PIN_JAVA_STRING(ENVONLY, prefix, virtPrefix, NULL, "H5Pset_virtual_prefix: virtual prefix not pinned"); if ((retVal = H5Pset_virtual_prefix((hid_t)dapl_id, virtPrefix)) < 0) diff --git a/java/src/jni/h5pDXPLImp.c b/java/src/jni/h5pDXPLImp.c index 2bdc36b..323fa8c 100644 --- a/java/src/jni/h5pDXPLImp.c +++ b/java/src/jni/h5pDXPLImp.c @@ -273,6 +273,9 @@ Java_hdf_hdf5lib_H5_H5Pset_1data_1transform UNUSED(clss); + if (NULL == expression) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_data_transform: data transform expression is NULL"); + PIN_JAVA_STRING(ENVONLY, expression, express, NULL, "H5Pset_data_transform: data transform expression not pinned"); if ((retVal = H5Pset_data_transform((hid_t)plist_id, express)) < 0) diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c index aec6581..acfc853 100644 --- a/java/src/jni/h5pFAPLImp.c +++ b/java/src/jni/h5pFAPLImp.c @@ -384,6 +384,9 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log UNUSED(clss); + if (NULL == logfile) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_fapl_log: log file name is NULL"); + PIN_JAVA_STRING(ENVONLY, logfile, pLogfile, NULL, "H5Pset_fapl_log: log file name not pinned"); if ((retVal = H5Pset_fapl_log((hid_t)fapl_id, pLogfile, (unsigned long long)flags, (size_t)buf_size)) < 0) @@ -421,10 +424,12 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi jlongArray memb_fapl, jobjectArray memb_name, jlongArray memb_addr, jboolean relax) { const char * const *mName = NULL; + const char *utf8 = NULL; jboolean isCopy; jboolean bb; jobject o; jstring rstring; + jstring obj; jclass Sjc; size_t i; jlong *thefaplArray = NULL; @@ -445,11 +450,8 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi PIN_LONG_ARRAY(ENVONLY, memb_addr, theaddrArray, &isCopy, "H5Pset_fapl_multi: memb_addr not pinned"); if (memb_name) { - jstring obj; - for (i = 0; i < H5FD_MEM_NTYPES; i++) { - const char *utf8 = NULL; - size_t str_len; + size_t str_len; if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray) memb_name, (jsize) i))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); @@ -474,6 +476,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi H5_JNI_FATAL_ERROR(ENVONLY, "H5Pset_fapl_multi: memory allocation failed"); HDstrncpy(member_name[i], utf8, str_len + 1); + (member_name[i])[str_len] = '\0'; UNPIN_JAVA_STRING(ENVONLY, obj, utf8); utf8 = NULL; @@ -493,6 +496,8 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); for (i = 0; i < H5FD_MEM_NTYPES; i++) { + if (!member_name[i]) continue; + if (NULL == (rstring = ENVPTR->NewStringUTF(ENVONLY, member_name[i]))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); H5_JNI_FATAL_ERROR(ENVONLY, "H5Pset_fapl_multi: out of memory - unable to construct string from UTF characters"); @@ -522,7 +527,12 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi } done: - h5str_array_free(member_name, H5FD_MEM_NTYPES); + for (i = 0; i < H5FD_MEM_NTYPES; i++) { + if (member_name[i]) + HDfree(member_name[i]); + } + if (utf8) + UNPIN_JAVA_STRING(ENVONLY, obj, utf8); if (theaddrArray) UNPIN_LONG_ARRAY(ENVONLY, memb_addr, theaddrArray, (status < 0) ? JNI_ABORT : 0); if (thefaplArray) @@ -621,6 +631,11 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split UNUSED(clss); + if (NULL == metaext) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_fapl_split: metaext is NULL"); + if (NULL == rawext) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_fapl_split: rawext is NULL"); + PIN_JAVA_STRING(ENVONLY, metaext, mstr, NULL, "H5Pset_fapl_split: metaext not pinned"); PIN_JAVA_STRING(ENVONLY, rawext, rstr, NULL, "H5Pset_fapl_split: rawext not pinned"); @@ -1125,12 +1140,17 @@ Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, cache_config, fid))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_mdc_config: cache_config not pinned"); + if (j_str) { + PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_mdc_config: cache_config not pinned"); - HDstrncpy(cacheinfo.trace_file_name, str, H5AC__MAX_TRACE_FILE_NAME_LEN + 1); + HDstrncpy(cacheinfo.trace_file_name, str, H5AC__MAX_TRACE_FILE_NAME_LEN + 1); + cacheinfo.trace_file_name[H5AC__MAX_TRACE_FILE_NAME_LEN] = '\0'; - UNPIN_JAVA_STRING(ENVONLY, j_str, str); - str = NULL; + UNPIN_JAVA_STRING(ENVONLY, j_str, str); + str = NULL; + } + else + HDmemset(cacheinfo.trace_file_name, 0, H5AC__MAX_TRACE_FILE_NAME_LEN + 1); if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "evictions_enabled", "Z"))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); @@ -1383,6 +1403,9 @@ Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options UNUSED(clss); + if (NULL == location) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_mdc_log_options: location string is NULL"); + PIN_JAVA_STRING(ENVONLY, location, locStr, NULL, "H5Pset_mdc_log_options: location string not pinned"); if ((retVal = H5Pset_mdc_log_options((hid_t)fapl_id, (hbool_t)is_enabled, locStr, (hbool_t)start_on_access)) < 0) diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index bed23c9..726e08c 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -174,6 +174,9 @@ Java_hdf_hdf5lib_H5__1H5Pcreate_1class close_callback = close_op; copy_callback = copy_op; + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "_H5Pcreate_class: class name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "_H5Pcreate_class: class name not pinned"); if ((class_id = H5Pcreate_class((hid_t)parent_class, cstr, (H5P_cls_create_func_t)H5P_cls_create_cb, (void *) create_data, @@ -201,6 +204,9 @@ Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "_H5Pcreate_class_nocb: class name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "_H5Pcreate_class_nocb: class name not pinned"); if ((class_id = H5Pcreate_class((hid_t)parent_class, cstr, NULL, NULL, NULL, NULL, NULL, NULL)) < 0) @@ -239,6 +245,9 @@ Java_hdf_hdf5lib_H5_H5Pregister2 get_callback = prp_get; delete_callback = prp_delete; + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pregister2: property name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pregister2: property name not pinned"); PIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, &isCopy, "H5Pregister2: default property value buffer not pinned"); @@ -271,6 +280,9 @@ Java_hdf_hdf5lib_H5_H5Pregister2_1nocb UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pregister2_nocb: property name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pregister2_nocb: property name not pinned"); PIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, &isCopy, "H5Pregister2_nocb: default property value buffer not pinned"); @@ -310,6 +322,9 @@ Java_hdf_hdf5lib_H5_H5Pinsert2 get_callback = prp_get; delete_callback = prp_delete; + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pinsert2: property name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pinsert2: property name not pinned"); PIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, &isCopy, "H5Pinsert2: property value buffer not pinned"); @@ -342,6 +357,9 @@ Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pinsert2_nocb: property name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pinsert2_nocb: property name not pinned"); PIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, &isCopy, "H5Pinsert2_nocb: property value buffer not pinned"); @@ -370,6 +388,9 @@ Java_hdf_hdf5lib_H5_H5Pset UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset: property name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pset: property name not pinned"); if ((retVal = H5Pset((hid_t)plid, cstr, &val)) < 0) @@ -396,6 +417,9 @@ Java_hdf_hdf5lib_H5_H5Pexist UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pexist: property name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pexist: property name not pinned"); if ((bval = H5Pexist((hid_t)plid, cstr)) < 0) @@ -425,6 +449,9 @@ Java_hdf_hdf5lib_H5_H5Pget_1size UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_size: property name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pget_size: property name not pinned"); if ((status = H5Pget_size((hid_t)plid, cstr, &size)) < 0) @@ -541,6 +568,9 @@ Java_hdf_hdf5lib_H5_H5Pget UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget: property name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pget: property name not pinned"); if ((status = H5Pget((hid_t)plid, cstr, &val)) < 0) @@ -629,6 +659,9 @@ Java_hdf_hdf5lib_H5_H5Pcopy_1prop UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pcopy_prop: property name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pcopy_prop: property name not pinned"); if ((retVal = H5Pcopy_prop((hid_t)dst_plid, (hid_t)src_plid, cstr)) < 0) @@ -655,6 +688,9 @@ Java_hdf_hdf5lib_H5_H5Premove UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Premove: property name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Premove: property name not pinned"); if ((retVal = H5Premove((hid_t)plid, cstr)) < 0) @@ -681,6 +717,9 @@ Java_hdf_hdf5lib_H5_H5Punregister UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Punregister: property name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Punregister: property name not pinned"); if ((retVal = H5Punregister((hid_t)plid, cstr)) < 0) diff --git a/java/src/jni/h5pLAPLImp.c b/java/src/jni/h5pLAPLImp.c index c4502d5..f2cb80a 100644 --- a/java/src/jni/h5pLAPLImp.c +++ b/java/src/jni/h5pLAPLImp.c @@ -96,6 +96,9 @@ Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix UNUSED(clss); + if (NULL == prefix) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_elink_prefix: prefix is NULL"); + PIN_JAVA_STRING(ENVONLY, prefix, linkPrefix, NULL, "H5Pset_elink_prefix: link prefix not pinned"); if ((retVal = H5Pset_elink_prefix((hid_t)lapl_id, linkPrefix)) < 0) diff --git a/java/src/jni/h5plImp.c b/java/src/jni/h5plImp.c index 4e096f1..90d78fe 100644 --- a/java/src/jni/h5plImp.c +++ b/java/src/jni/h5plImp.c @@ -83,6 +83,9 @@ Java_hdf_hdf5lib_H5_H5PLappend UNUSED(clss); + if (NULL == plugin_path) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5PLappend: new path is NULL"); + PIN_JAVA_STRING(ENVONLY, plugin_path, newPath, NULL, "H5PLappend: new path not pinned"); if ((retVal = H5PLappend(newPath)) < 0) @@ -106,6 +109,9 @@ Java_hdf_hdf5lib_H5_H5PLprepend UNUSED(clss); + if (NULL == plugin_path) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5PLprepend: new path is NULL"); + PIN_JAVA_STRING(ENVONLY, plugin_path, newPath, NULL, "H5PLprepend: new path not pinned"); if ((retVal = H5PLprepend(newPath)) < 0) @@ -130,6 +136,9 @@ Java_hdf_hdf5lib_H5_H5PLreplace UNUSED(clss); + if (NULL == plugin_path) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5PLreplace: new path is NULL"); + if (index < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5PLreplace: index < 0"); @@ -157,6 +166,9 @@ Java_hdf_hdf5lib_H5_H5PLinsert UNUSED(clss); + if (NULL == plugin_path) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5PLinsert: new path is NULL"); + if (index < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5PLinsert: index < 0"); diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c index 9278113..83e2216 100644 --- a/java/src/jni/h5rImp.c +++ b/java/src/jni/h5rImp.c @@ -50,6 +50,8 @@ Java_hdf_hdf5lib_H5_H5Rcreate if (NULL == ref) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: reference is NULL"); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: name is NULL"); if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c index 67ea59d..a91dab2 100644 --- a/java/src/jni/h5sImp.c +++ b/java/src/jni/h5sImp.c @@ -510,7 +510,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1type UNUSED(clss); if (space_id < 0) - H5_LIBRARY_ERROR(ENVONLY); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_simple_extent_type: space_id < 0"); if (H5S_NO_CLASS == (retVal = H5Sget_simple_extent_type(space_id))) H5_LIBRARY_ERROR(ENVONLY); diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c index 08ddf85..313ca8b 100644 --- a/java/src/jni/h5tImp.c +++ b/java/src/jni/h5tImp.c @@ -48,6 +48,9 @@ Java_hdf_hdf5lib_H5__1H5Topen2 UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Topen2: datatype name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, datatypeName, NULL, "H5Topen2: datatype name not pinned"); if ((status = H5Topen2((hid_t)loc_id, datatypeName, (hid_t)access_plist)) < 0) @@ -855,7 +858,10 @@ Java_hdf_hdf5lib_H5_H5Tget_1member_1index UNUSED(clss); - PIN_JAVA_STRING(ENVONLY, field_name, datatypeName, NULL, "H5Tget_member_index: datatype name not pinned"); + if (NULL == field_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tget_member_index: field name is NULL"); + + PIN_JAVA_STRING(ENVONLY, field_name, datatypeName, NULL, "H5Tget_member_index: field name not pinned"); if ((index = H5Tget_member_index((hid_t)type_id, datatypeName)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -937,6 +943,9 @@ Java_hdf_hdf5lib_H5_H5Tinsert UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tinsert: datatype name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, datatypeName, NULL, "H5Tinsert: datatype name not pinned"); if ((status = H5Tinsert((hid_t)type_id, datatypeName, (size_t)off, field_id)) < 0) @@ -1023,6 +1032,9 @@ Java_hdf_hdf5lib_H5_H5Tset_1tag UNUSED(clss); + if (NULL == tag) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tset_tag: tag is NULL"); + PIN_JAVA_STRING(ENVONLY, tag, tagBuf, NULL, "H5Tset_tag: tag buffer not pinned"); if ((status = H5Tset_tag((hid_t)type, tagBuf)) < 0) @@ -1119,11 +1131,13 @@ Java_hdf_hdf5lib_H5_H5Tenum_1insert_1int UNUSED(clss); if (NULL == value) - H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_insert: value is NULL"); + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_insert_int: value is NULL"); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_insert_int: member name is NULL"); - PIN_JAVA_STRING(ENVONLY, name, memberName, NULL, "H5Tenum_insert: member name not pinned"); + PIN_JAVA_STRING(ENVONLY, name, memberName, NULL, "H5Tenum_insert_int: member name not pinned"); - PIN_INT_ARRAY(ENVONLY, value, intBuf, &isCopy, "H5Tenum_insert: int buffer not pinned"); + PIN_INT_ARRAY(ENVONLY, value, intBuf, &isCopy, "H5Tenum_insert_int: int buffer not pinned"); if ((status = H5Tenum_insert((hid_t)type_id, memberName, intBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1155,6 +1169,8 @@ Java_hdf_hdf5lib_H5_H5Tenum_1insert if (NULL == value) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_insert: value is NULL"); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_insert: member name is NULL"); PIN_JAVA_STRING(ENVONLY, name, memberName, NULL, "H5Tenum_insert: member name not pinned"); @@ -1234,10 +1250,10 @@ Java_hdf_hdf5lib_H5_H5Tenum_1nameof UNUSED(clss); - if (NULL == value) - H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_nameof: value is NULL"); if (size <= 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tenum_nameof: name size < 0"); + if (NULL == value) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_nameof: value is NULL"); if (NULL == (nameP = (char *) HDmalloc(sizeof(char) * (size_t)size))) H5_JNI_FATAL_ERROR(ENVONLY, "H5Tenum_nameof: failed to allocate name buffer"); @@ -1278,6 +1294,8 @@ Java_hdf_hdf5lib_H5_H5Tenum_1valueof_1int if (NULL == value) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_valueof_int: value is NULL"); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_valueof_int: enum value name is NULL"); PIN_JAVA_STRING(ENVONLY, name, enumValue, NULL, "H5Tenum_valueof_int: enum value not pinned"); @@ -1313,6 +1331,8 @@ Java_hdf_hdf5lib_H5_H5Tenum_1valueof if (NULL == value) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_valueof: value is NULL"); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_valueof: enum value name is NULL"); PIN_JAVA_STRING(ENVONLY, name, enumValue, NULL, "H5Tenum_valueof: enum value not pinned"); @@ -1533,6 +1553,9 @@ Java_hdf_hdf5lib_H5_H5Tcommit UNUSED(clss); + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tcommit: datatype name is NULL"); + PIN_JAVA_STRING(ENVONLY, name, datatypeName, NULL, "H5Tcommit: datatype name not pinned"); if ((status = H5Tcommit2((hid_t)loc_id, datatypeName, (hid_t)type, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id)) < 0) @@ -1561,10 +1584,10 @@ Java_hdf_hdf5lib_H5__1H5Tarray_1create2 UNUSED(clss); - if (NULL == dims) - H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tarray_create: dims is NULL"); if (rank <= 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tarray_create: rank is < 1"); + if (NULL == dims) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tarray_create: dims is NULL"); PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Tarray_create: dimsP not pinned"); diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 4208ce1..fce969e 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -232,7 +232,7 @@ h5str_convert HDmemcpy(cptr, &tmp_double, sizeof(double)); break; } -#if H5_SIZEOF_LONG_DOUBLE != 0 +#if H5_SIZEOF_LONG_DOUBLE != 0 && H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE case sizeof(long double): { long double tmp_ldouble = 0.0; @@ -259,6 +259,8 @@ h5str_convert if (len > 0) { HDstrncpy(cptr, this_str, typeSize); + cptr[typeSize - 1] = '\0'; + retVal = typeSize; } else { @@ -329,6 +331,7 @@ h5str_convert break; } +#if H5_SIZEOF_LONG != H5_SIZEOF_INT case sizeof(long): { unsigned long tmp_ulong = 0; @@ -345,7 +348,7 @@ h5str_convert break; } - +#endif #if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG case sizeof(long long): { @@ -444,14 +447,14 @@ h5str_convert value = &tmp_ushort; break; } - +#if H5_SIZEOF_LONG != H5_SIZEOF_INT case sizeof(long): { unsigned long tmp_ulong = 0; value = &tmp_ulong; break; } - +#endif #if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG case sizeof(long long): { @@ -694,7 +697,7 @@ h5str_sprintf break; } -#if H5_SIZEOF_LONG_DOUBLE != 0 +#if H5_SIZEOF_LONG_DOUBLE != 0 && H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE case sizeof(long double): { long double tmp_ldouble = 0.0; @@ -750,6 +753,7 @@ h5str_sprintf H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); HDstrncpy(this_str, tmp_str, typeSize); + this_str[typeSize] = '\0'; } } @@ -844,7 +848,7 @@ h5str_sprintf break; } - +#if H5_SIZEOF_LONG != H5_SIZEOF_INT case sizeof(long): { unsigned long tmp_ulong = 0; @@ -871,7 +875,7 @@ h5str_sprintf break; } - +#endif #if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG case sizeof(long long): { diff --git a/java/src/jni/h5vlImp.c b/java/src/jni/h5vlImp.c index c816abf..92e456e 100644 --- a/java/src/jni/h5vlImp.c +++ b/java/src/jni/h5vlImp.c @@ -41,6 +41,9 @@ Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1name UNUSED(clss); + if (NULL == connector_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5VLregister_connector_by_name: VOL connector name is NULL"); + PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLregister_connector_by_name: VOL connector name not pinned"); if ((status = H5VLregister_connector_by_name(volName, (hid_t)vipl_id)) < 0) @@ -87,6 +90,9 @@ Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered UNUSED(clss); + if (NULL == connector_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5VLis_connector_registered: VOL connector name is NULL"); + PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLis_connector_registered: VOL connector name not pinned"); if ((bval = H5VLis_connector_registered(volName)) < 0) @@ -115,6 +121,9 @@ Java_hdf_hdf5lib_H5_H5VLget_1connector_1id UNUSED(clss); + if (NULL == connector_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5VLget_connector_id: VOL connector name is NULL"); + PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLget_connector_id: VOL connector name not pinned"); if ((status = H5VLget_connector_id(volName)) < 0) diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java index 591793f..ee2850b 100644 --- a/java/test/TestH5Edefault.java +++ b/java/test/TestH5Edefault.java @@ -243,7 +243,7 @@ public class TestH5Edefault { H5.H5Eget_class_name(-1); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = HDF5LibraryException.class) public void testH5Eget_class_name_invalid_classname() throws Throwable { H5.H5Eget_class_name(HDF5Constants.H5E_DEFAULT); } diff --git a/java/test/TestH5Oparams.java b/java/test/TestH5Oparams.java index 8b3c673..d340ee7 100644 --- a/java/test/TestH5Oparams.java +++ b/java/test/TestH5Oparams.java @@ -124,7 +124,7 @@ public class TestH5Oparams { H5.H5Oset_comment(-1, "Bogus"); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = HDF5LibraryException.class) public void testH5Oget_comment_invalid() throws Throwable { H5.H5Oget_comment(-1); } @@ -139,7 +139,7 @@ public class TestH5Oparams { H5.H5Oset_comment_by_name(-1, null, null, -1); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = HDF5LibraryException.class) public void testH5Oget_comment_by_name_invalid() throws Throwable { H5.H5Oget_comment_by_name(-1, "Bogus", -1); } diff --git a/java/test/TestH5Sbasic.java b/java/test/TestH5Sbasic.java index 3007495..2173647 100644 --- a/java/test/TestH5Sbasic.java +++ b/java/test/TestH5Sbasic.java @@ -49,7 +49,7 @@ public class TestH5Sbasic { H5.H5Screate(-1); } - @Test(expected = HDF5LibraryException.class) + @Test(expected = IllegalArgumentException.class) public void testH5Sget_simple_extent_type_invalid() throws Throwable { H5.H5Sget_simple_extent_type(-1); } |