summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/examples/datasets/JavaDatasetExample.sh.in45
-rw-r--r--java/examples/datatypes/JavaDatatypeExample.sh.in43
-rw-r--r--java/examples/groups/JavaGroupExample.sh.in70
-rw-r--r--java/examples/intro/JavaIntroExample.sh.in43
-rw-r--r--java/src/hdf/hdf5lib/H5.java4
-rw-r--r--java/src/hdf/overview.html2
-rw-r--r--java/src/jni/CMakeLists.txt14
-rw-r--r--java/src/jni/h5Imp.c1
-rw-r--r--java/src/jni/h5aImp.c22
-rw-r--r--java/src/jni/h5dImp.c21
-rw-r--r--java/src/jni/h5eImp.c18
-rw-r--r--java/src/jni/h5fImp.c7
-rw-r--r--java/src/jni/h5gImp.c1
-rw-r--r--java/src/jni/h5iImp.c1
-rw-r--r--java/src/jni/h5lImp.c29
-rw-r--r--java/src/jni/h5oImp.c21
-rw-r--r--java/src/jni/h5pImp.c34
-rw-r--r--java/src/jni/h5plImp.c1
-rw-r--r--java/src/jni/h5rImp.c1
-rw-r--r--java/src/jni/h5sImp.c7
-rw-r--r--java/src/jni/h5tImp.c1
-rw-r--r--java/src/jni/h5util.c11
-rw-r--r--java/test/TestH5.java4
-rw-r--r--java/test/TestH5E.java18
-rw-r--r--java/test/TestH5Edefault.java43
-rw-r--r--java/test/junit.sh.in38
26 files changed, 327 insertions, 173 deletions
diff --git a/java/examples/datasets/JavaDatasetExample.sh.in b/java/examples/datasets/JavaDatasetExample.sh.in
index cb16d45..f5c63cd 100644
--- a/java/examples/datasets/JavaDatasetExample.sh.in
+++ b/java/examples/datasets/JavaDatasetExample.sh.in
@@ -52,12 +52,14 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR
# Comment '#' without space can be used.
# --------------------------------------------------------------------
LIST_LIBRARY_FILES="
-$HDFLIB_HOME/slf4j-api-1.7.25.jar
-$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
$top_builddir/src/.libs/libhdf5.*
$top_builddir/java/src/jni/.libs/libhdf5_java.*
$top_builddir/java/src/$JARFILE
"
+LIST_JAR_TESTFILES="
+$HDFLIB_HOME/slf4j-api-1.7.25.jar
+$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
+"
LIST_DATA_FILES="
$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Alloc.txt
$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Checksum.txt
@@ -83,6 +85,7 @@ $HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Soint.txt
# copy files from source dirs to test dir
#
COPY_LIBFILES="$LIST_LIBRARY_FILES"
+COPY_JARTESTFILES="$LIST_JAR_TESTFILES"
COPY_LIBFILES_TO_BLDLIBDIR()
{
@@ -110,6 +113,30 @@ COPY_LIBFILES_TO_BLDLIBDIR()
fi
fi
done
+ # copy jar files. Used -f to make sure get a new copy
+ for tstfile in $COPY_JARTESTFILES
+ do
+ # ignore '#' comment
+ echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
+ RET=$?
+ if [ $RET -eq 1 ]; then
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $BLDLIBDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
}
CLEAN_LIBFILES_AND_BLDLIBDIR()
@@ -117,11 +144,14 @@ CLEAN_LIBFILES_AND_BLDLIBDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.25.jar`
+ SDIR=$HDFLIB_HOME
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
- $RM $BLDLIBDIR
+ for tstfile in $COPY_JARTESTFILES
+ do
+ $RM $BLDLIBDIR/tstfile
+ done
fi
}
@@ -215,14 +245,9 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then
fi
case $os_name in
- Darwin)
- DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH
- export DYLD_LIBRARY_PATH
- LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
- ;;
*)
LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH
- ;;
+ ;;
esac
export LD_LIBRARY_PATH
diff --git a/java/examples/datatypes/JavaDatatypeExample.sh.in b/java/examples/datatypes/JavaDatatypeExample.sh.in
index 033442a..447512a 100644
--- a/java/examples/datatypes/JavaDatatypeExample.sh.in
+++ b/java/examples/datatypes/JavaDatatypeExample.sh.in
@@ -49,12 +49,14 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR
# Comment '#' without space can be used.
# --------------------------------------------------------------------
LIST_LIBRARY_FILES="
-$HDFLIB_HOME/slf4j-api-1.7.25.jar
-$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
$top_builddir/src/.libs/libhdf5.*
$top_builddir/java/src/jni/.libs/libhdf5_java.*
$top_builddir/java/src/$JARFILE
"
+LIST_JAR_TESTFILES="
+$HDFLIB_HOME/slf4j-api-1.7.25.jar
+$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
+"
LIST_DATA_FILES="
$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Array.txt
$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_ArrayAttribute.txt
@@ -80,6 +82,7 @@ $HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_VLString.txt
# copy files from source dirs to test dir
#
COPY_LIBFILES="$LIST_LIBRARY_FILES"
+COPY_JARTESTFILES="$LIST_JAR_TESTFILES"
COPY_LIBFILES_TO_BLDLIBDIR()
{
@@ -107,6 +110,30 @@ COPY_LIBFILES_TO_BLDLIBDIR()
fi
fi
done
+ # copy jar files. Used -f to make sure get a new copy
+ for tstfile in $COPY_JARTESTFILES
+ do
+ # ignore '#' comment
+ echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
+ RET=$?
+ if [ $RET -eq 1 ]; then
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $BLDLIBDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
}
CLEAN_LIBFILES_AND_BLDLIBDIR()
@@ -114,11 +141,14 @@ CLEAN_LIBFILES_AND_BLDLIBDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.25.jar`
+ SDIR=$HDFLIB_HOME
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
- $RM $BLDLIBDIR
+ for tstfile in $COPY_JARTESTFILES
+ do
+ $RM $BLDLIBDIR/tstfile
+ done
fi
}
@@ -211,11 +241,6 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then
fi
case $os_name in
- Darwin)
- DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH
- export DYLD_LIBRARY_PATH
- LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
- ;;
*)
LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH
;;
diff --git a/java/examples/groups/JavaGroupExample.sh.in b/java/examples/groups/JavaGroupExample.sh.in
index 36df02e..9d4673f 100644
--- a/java/examples/groups/JavaGroupExample.sh.in
+++ b/java/examples/groups/JavaGroupExample.sh.in
@@ -34,13 +34,13 @@ nerrors=0
# where the libs exist
HDFLIB_HOME="$top_srcdir/java/lib"
BLDLIBDIR="$top_builddir/hdf5/lib"
-BLDREFDIR="./groups"
+BLDITERDIR="./groups"
BLDDIR="."
HDFTEST_HOME="$top_srcdir/java/examples/groups"
JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar
TESTJARFILE=jar@PACKAGE_TARNAME@groups.jar
test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR
-test -d $BLDREFDIR || mkdir -p $BLDREFDIR
+test -d $BLDITERDIR || mkdir -p $BLDITERDIR
######################################################################
# library files
@@ -51,13 +51,15 @@ test -d $BLDREFDIR || mkdir -p $BLDREFDIR
# Comment '#' without space can be used.
# --------------------------------------------------------------------
LIST_LIBRARY_FILES="
-$HDFLIB_HOME/slf4j-api-1.7.25.jar
-$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
$top_builddir/src/.libs/libhdf5.*
$top_builddir/java/src/jni/.libs/libhdf5_java.*
$top_builddir/java/src/$JARFILE
"
-LIST_REF_FILES="
+LIST_JAR_TESTFILES="
+$HDFLIB_HOME/slf4j-api-1.7.25.jar
+$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
+"
+LIST_ITER_FILES="
$HDFTEST_HOME/h5ex_g_iterate.h5
$HDFTEST_HOME/h5ex_g_visit.h5
"
@@ -75,6 +77,7 @@ $HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Visit.txt
# copy files from source dirs to test dir
#
COPY_LIBFILES="$LIST_LIBRARY_FILES"
+COPY_JARTESTFILES="$LIST_JAR_TESTFILES"
COPY_LIBFILES_TO_BLDLIBDIR()
{
@@ -102,6 +105,30 @@ COPY_LIBFILES_TO_BLDLIBDIR()
fi
fi
done
+ # copy jar files. Used -f to make sure get a new copy
+ for tstfile in $COPY_JARTESTFILES
+ do
+ # ignore '#' comment
+ echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
+ RET=$?
+ if [ $RET -eq 1 ]; then
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $BLDLIBDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
}
CLEAN_LIBFILES_AND_BLDLIBDIR()
@@ -109,11 +136,14 @@ CLEAN_LIBFILES_AND_BLDLIBDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.25.jar`
+ SDIR=$HDFLIB_HOME
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
- $RM $BLDLIBDIR
+ for tstfile in $COPY_JARTESTFILES
+ do
+ $RM $BLDLIBDIR/tstfile
+ done
fi
}
@@ -152,6 +182,7 @@ CLEAN_DATAFILES_AND_BLDDIR()
$RM $BLDDIR/examples.groups.H5Ex_G_*.txt
$RM $BLDDIR/H5Ex_G_*.out
$RM $BLDDIR/H5Ex_G_*.h5
+ $RM $BLDDIR/h5ex_g_*.h5
SDIR=`$DIRNAME $tstfile`
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'`
@@ -161,12 +192,12 @@ CLEAN_DATAFILES_AND_BLDDIR()
fi
}
-COPY_REFFILES="$LIST_REF_FILES"
+COPY_ITERFILES="$LIST_ITER_FILES"
-COPY_REFFILES_TO_BLDREFDIR()
+COPY_ITERFILES_TO_BLDITERDIR()
{
# copy test files. Used -f to make sure get a new copy
- for tstfile in $COPY_REFFILES
+ for tstfile in $COPY_ITERFILES
do
# ignore '#' comment
echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
@@ -177,9 +208,9 @@ COPY_REFFILES_TO_BLDREFDIR()
# make cp fail
SDIR=`$DIRNAME $tstfile`
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
- INODE_DDIR=`$LS -i -d $BLDREFDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $BLDITERDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
- $CP -f $tstfile $BLDREFDIR
+ $CP -f $tstfile $BLDITERDIR
if [ $? -ne 0 ]; then
echo "Error: FAILED to copy $tstfile ."
@@ -191,16 +222,16 @@ COPY_REFFILES_TO_BLDREFDIR()
done
}
-CLEAN_REFFILES_AND_BLDREFDIR()
+CLEAN_ITERFILES_AND_BLDITERDIR()
{
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
SDIR=`$DIRNAME $HDFTEST_HOME/h5ex_g_iterate.h5`
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
- INODE_DDIR=`$LS -i -d $BLDREFDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $BLDITERDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
- $RM $BLDREFDIR
+ $RM $BLDITERDIR
fi
}
@@ -223,7 +254,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@
# prepare for test
COPY_LIBFILES_TO_BLDLIBDIR
COPY_DATAFILES_TO_BLDDIR
-COPY_REFFILES_TO_BLDREFDIR
+COPY_ITERFILES_TO_BLDITERDIR
CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE""
@@ -257,11 +288,6 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then
fi
case $os_name in
- Darwin)
- DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH
- export DYLD_LIBRARY_PATH
- LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
- ;;
*)
LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH
;;
@@ -340,9 +366,9 @@ else
fi
# Clean up temporary files/directories
+CLEAN_ITERFILES_AND_BLDITERDIR
CLEAN_LIBFILES_AND_BLDLIBDIR
CLEAN_DATAFILES_AND_BLDDIR
-CLEAN_REFFILES_AND_BLDREFDIR
# Report test results and exit
if test $nerrors -eq 0 ; then
diff --git a/java/examples/intro/JavaIntroExample.sh.in b/java/examples/intro/JavaIntroExample.sh.in
index 077146d..1886485 100644
--- a/java/examples/intro/JavaIntroExample.sh.in
+++ b/java/examples/intro/JavaIntroExample.sh.in
@@ -49,12 +49,14 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR
# Comment '#' without space can be used.
# --------------------------------------------------------------------
LIST_LIBRARY_FILES="
-$HDFLIB_HOME/slf4j-api-1.7.25.jar
-$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
$top_builddir/src/.libs/libhdf5.*
$top_builddir/java/src/jni/.libs/libhdf5_java.*
$top_builddir/java/src/$JARFILE
"
+LIST_JAR_TESTFILES="
+$HDFLIB_HOME/slf4j-api-1.7.25.jar
+$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
+"
LIST_DATA_FILES="
$HDFTEST_HOME/../testfiles/examples.intro.H5_CreateDataset.txt
$HDFTEST_HOME/../testfiles/examples.intro.H5_CreateAttribute.txt
@@ -69,6 +71,7 @@ $HDFTEST_HOME/../testfiles/examples.intro.H5_ReadWrite.txt
# copy files from source dirs to test dir
#
COPY_LIBFILES="$LIST_LIBRARY_FILES"
+COPY_JARTESTFILES="$LIST_JAR_TESTFILES"
COPY_LIBFILES_TO_BLDLIBDIR()
{
@@ -96,6 +99,30 @@ COPY_LIBFILES_TO_BLDLIBDIR()
fi
fi
done
+ # copy jar files. Used -f to make sure get a new copy
+ for tstfile in $COPY_JARTESTFILES
+ do
+ # ignore '#' comment
+ echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
+ RET=$?
+ if [ $RET -eq 1 ]; then
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $BLDLIBDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
}
CLEAN_LIBFILES_AND_BLDLIBDIR()
@@ -103,11 +130,14 @@ CLEAN_LIBFILES_AND_BLDLIBDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.25.jar`
+ SDIR=$HDFLIB_HOME
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
- $RM $BLDLIBDIR
+ for tstfile in $COPY_JARTESTFILES
+ do
+ $RM $BLDLIBDIR/tstfile
+ done
fi
}
@@ -200,11 +230,6 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then
fi
case $os_name in
- Darwin)
- DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH
- export DYLD_LIBRARY_PATH
- LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
- ;;
*)
LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH
;;
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java
index 9c62538..d8df814 100644
--- a/java/src/hdf/hdf5lib/H5.java
+++ b/java/src/hdf/hdf5lib/H5.java
@@ -214,7 +214,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* exception handlers to print out the HDF-5 error stack.
* <hr>
*
- * @version HDF5 1.10.3 <BR>
+ * @version HDF5 1.10.4 <BR>
* <b>See also: <a href ="./hdf.hdf5lib.HDFArray.html"> hdf.hdf5lib.HDFArray</a> </b><BR>
* <a href ="./hdf.hdf5lib.HDF5Constants.html"> hdf.hdf5lib.HDF5Constants</a><BR>
* <a href ="./hdf.hdf5lib.HDF5CDataTypes.html"> hdf.hdf5lib.HDF5CDataTypes</a><BR>
@@ -237,7 +237,7 @@ public class H5 implements java.io.Serializable {
*
* Make sure to update the versions number when a different library is used.
*/
- public final static int LIB_VERSION[] = { 1, 10, 3 };
+ public final static int LIB_VERSION[] = { 1, 10, 4 };
public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib";
diff --git a/java/src/hdf/overview.html b/java/src/hdf/overview.html
index 52dabf7..edb1b76 100644
--- a/java/src/hdf/overview.html
+++ b/java/src/hdf/overview.html
@@ -12,7 +12,7 @@ of the unsupported functions have C function pointers, which is not currently
implemented in JHI5.</p>
<table style="width:71%;text-align:center;background-color:#dbeaf5" border="1">
-<caption>Java HD5 Interface (JHI5)</caption>
+<caption>Java HDF5 Interface (JHI5)</caption>
<tr>
<td style="text-align:center;">
Note: The JHI5 does not support HDF4 or earlier.
diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt
index a0228e1..7b95e0b 100644
--- a/java/src/jni/CMakeLists.txt
+++ b/java/src/jni/CMakeLists.txt
@@ -50,22 +50,10 @@ set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
add_library (${HDF5_JAVA_JNI_LIB_TARGET} SHARED ${HDF5_JAVA_JNI_CSRCS} ${HDF5_JAVA_JNI_CHDRS})
target_include_directories(${HDF5_JAVA_JNI_LIB_TARGET} PRIVATE ${HDF5_BINARY_DIR} ${HDF5_JAVA_JNI_SOURCE_DIR})
TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED)
-target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET})
+target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} PUBLIC ${HDF5_LIBSH_TARGET})
set_target_properties (${HDF5_JAVA_JNI_LIB_TARGET} PROPERTIES FOLDER libraries/jni)
SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_JAVA_JNI_LIB_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_JAVA_JNI_LIB_NAME} SHARED "JAVA")
-if (WIN32)
- get_filename_component (HDF5_JAVA_JNI_DLL_NAME ${HDF5_JAVA_JNI_LIB_TARGET} NAME_WE)
- set (HDF5_JAVA_JNI_DLL_NAME "${HDF5_JAVA_JNI_DLL_NAME}$<$<CONFIG:Debug>:_D>")
- # message (STATUS "HDF5_JAVA_JNI_DLL_NAME: ${HDF5_JAVA_JNI_DLL_NAME}")
- if (BUILD_TESTING)
- add_custom_target (HDF5_JAVA_JNI-Test-Copy ALL
- COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
- COMMENT "Copying ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
- )
- add_dependencies (HDF5_JAVA_JNI-Test-Copy ${HDF5_JAVA_JNI_LIB_TARGET})
- endif ()
-endif ()
#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install for import into other projects
diff --git a/java/src/jni/h5Imp.c b/java/src/jni/h5Imp.c
index 2eeb075..1ad6b17 100644
--- a/java/src/jni/h5Imp.c
+++ b/java/src/jni/h5Imp.c
@@ -36,7 +36,6 @@ extern "C" {
#include "h5Imp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
/*
* Class: hdf_hdf5lib_H5
diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c
index c0dc182..aba2240 100644
--- a/java/src/jni/h5aImp.c
+++ b/java/src/jni/h5aImp.c
@@ -29,7 +29,11 @@ extern "C" {
#include "h5aImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
+
+typedef struct _cb_wrapper {
+ jobject visit_callback;
+ jobject op_data;
+} cb_wrapper;
#ifdef __cplusplus
#define CBENVPTR (cbenv)
@@ -53,7 +57,8 @@ static herr_t H5AwriteVL_asstr (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjec
static herr_t H5AwriteVL_str (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf);
static herr_t H5AreadVL_asstr (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf);
static herr_t H5AreadVL_str (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf);
-static herr_t H5A_iterate_cb(hid_t g_id, const char *name, const H5A_info_t *info, void *op_data);
+
+static herr_t H5A_iterate_cb(hid_t g_id, const char *name, const H5A_info_t *info, void *cb_data);
/*
@@ -1138,7 +1143,7 @@ Java_hdf_hdf5lib_H5__1H5Aget_1create_1plist
static herr_t
H5A_iterate_cb
- (hid_t g_id, const char *name, const H5A_info_t *info, void *op_data) {
+ (hid_t g_id, const char *name, const H5A_info_t *info, void *cb_data) {
JNIEnv *cbenv;
jint status = -1;
jclass cls;
@@ -1147,6 +1152,9 @@ H5A_iterate_cb
jmethodID constructor;
jvalue args[4];
jobject cb_info_t = NULL;
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ void *op_data = (void *)wrapper->op_data;
+ jobject visit_callback = wrapper->visit_callback;
if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
@@ -1195,14 +1203,14 @@ Java_hdf_hdf5lib_H5_H5Aiterate
hsize_t start_idx = (hsize_t)idx;
herr_t status = -1;
+ cb_wrapper wrapper = {callback_op, op_data};
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if ((op_data == NULL) || (callback_op == NULL)) {
h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL");
} /* end if */
else {
- status = H5Aiterate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)op_data);
+ status = H5Aiterate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)&wrapper);
if (status < 0)
h5libraryError(env);
@@ -1224,9 +1232,9 @@ Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name
const char *lName;
hsize_t start_idx = (hsize_t)idx;
herr_t status = -1;
+ cb_wrapper wrapper = {callback_op, op_data};
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if ((op_data == NULL) || (callback_op == NULL)) {
h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL");
@@ -1234,7 +1242,7 @@ Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name
else {
PIN_JAVA_STRING(name, lName);
if (lName != NULL) {
- status = H5Aiterate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)op_data, (hid_t)access_id);
+ status = H5Aiterate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)&wrapper, (hid_t)access_id);
UNPIN_JAVA_STRING(name, lName);
diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c
index 205e9fb..652c873 100644
--- a/java/src/jni/h5dImp.c
+++ b/java/src/jni/h5dImp.c
@@ -30,7 +30,11 @@ extern "C" {
#include "h5dImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
+
+typedef struct _cb_wrapper {
+ jobject visit_callback;
+ jobject op_data;
+} cb_wrapper;
#ifdef __cplusplus
#ifdef _WINDOWS
@@ -1105,7 +1109,7 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1string
const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0);
if (utf8) {
- strncpy(&c_buf[i * str_len], utf8, str_len);
+ HDstrncpy(&c_buf[i * str_len], utf8, str_len);
} /* end if */
ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8);
@@ -1362,13 +1366,9 @@ Java_hdf_hdf5lib_H5_H5DwriteVL
isVlenStr = 1; /* strings created by H5Tvlen_create(H5T_C_S1) */
}
if (isStr == 0 || isComplex>0 || isVlenStr) {
- h5unimplemented(env, "H5DwriteVL: VL types, which are not string type, not implemented");
- status = -1;
-#ifdef notdef
status = H5DwriteVL_asstr(env, (hid_t)dataset_id, (hid_t)mem_type_id,
(hid_t)mem_space_id, (hid_t)file_space_id,
(hid_t)xfer_plist_id, buf);
-#endif
}
else if (isStr > 0) {
status = H5DwriteVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
@@ -1892,7 +1892,7 @@ Java_hdf_hdf5lib_H5_H5Dset_1extent
static herr_t
H5D_iterate_cb
- (void* elem, hid_t elem_id, unsigned ndim, const hsize_t *point, void *op_data) {
+ (void* elem, hid_t elem_id, unsigned ndim, const hsize_t *point, void *cb_data) {
JNIEnv *cbenv;
jint status;
jclass cls;
@@ -1900,6 +1900,9 @@ H5D_iterate_cb
jbyteArray elemArray;
jlongArray pointArray;
jsize size;
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ void *op_data = (void *)wrapper->op_data;
+ jobject visit_callback = wrapper->visit_callback;
if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) {
JVMPTR->DetachCurrentThread(JVMPAR);
@@ -1962,9 +1965,9 @@ Java_hdf_hdf5lib_H5_H5Diterate
herr_t status = -1;
jboolean isCopy;
jbyte *buffP;
+ cb_wrapper wrapper = {callback_op, op_data};
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if (op_data == NULL) {
h5nullArgument(env, "H5Diterate: op_data is NULL");
@@ -1981,7 +1984,7 @@ Java_hdf_hdf5lib_H5_H5Diterate
h5JNIFatalError(env, "H5Diterate: buf not pinned");
} /* end if */
else {
- status = H5Diterate((void*)buffP, (hid_t)buf_type, (hid_t)space, (H5D_operator_t)H5D_iterate_cb, (void*)op_data);
+ status = H5Diterate((void*)buffP, (hid_t)buf_type, (hid_t)space, (H5D_operator_t)H5D_iterate_cb, (void*)&wrapper);
if (status < 0) {
ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, JNI_ABORT);
diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c
index 10a02b0..9c80461 100644
--- a/java/src/jni/h5eImp.c
+++ b/java/src/jni/h5eImp.c
@@ -40,7 +40,11 @@ extern "C" {
#include "h5eImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
+
+typedef struct _cb_wrapper {
+ jobject visit_callback;
+ jobject op_data;
+} cb_wrapper;
#ifdef __cplusplus
#define CBENVPTR (cbenv)
@@ -60,7 +64,7 @@ extern jobject visit_callback;
/* Local Prototypes */
/********************/
-static herr_t H5E_walk_cb(int nindx, const H5E_error2_t *info, void *op_data);
+static herr_t H5E_walk_cb(int nindx, const H5E_error2_t *info, void *cb_data);
/*
* Class: hdf_hdf5lib_H5
@@ -475,7 +479,7 @@ Java_hdf_hdf5lib_H5_H5Eget_1num
static herr_t
H5E_walk_cb
- (int nindx, const H5E_error2_t *info, void *op_data)
+ (int nindx, const H5E_error2_t *info, void *cb_data)
{
JNIEnv *cbenv;
jint status = -1;
@@ -485,6 +489,9 @@ H5E_walk_cb
jmethodID constructor;
jvalue args[7];
jobject cb_info_t = NULL;
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ void *op_data = (void *)wrapper->op_data;
+ jobject visit_callback = wrapper->visit_callback;
if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
@@ -532,13 +539,14 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Ewalk2
(JNIEnv *env, jclass cls, jlong stk_id, jlong direction, jobject callback_op, jobject op_data)
{
+ cb_wrapper wrapper = {callback_op, op_data};
+
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if ((op_data == NULL) || (callback_op == NULL)) {
h5nullArgument(env, "H5Ewalk2: op_data or callback_op is NULL");
} /* end if */
- else if (H5Ewalk2(stk_id, (H5E_direction_t)direction, (H5E_walk2_t)H5E_walk_cb, (void*)op_data) < 0)
+ else if (H5Ewalk2(stk_id, (H5E_direction_t)direction, (H5E_walk2_t)H5E_walk_cb, (void*)&wrapper) < 0)
h5libraryError(env);
} /* end iJava_hdf_hdf5lib_H5_H5Ewalk2f */
diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c
index 8cf5252..9d68290 100644
--- a/java/src/jni/h5fImp.c
+++ b/java/src/jni/h5fImp.c
@@ -29,7 +29,6 @@ extern "C" {
#include "h5util.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
/*
* Class: hdf_hdf5lib_H5
@@ -541,7 +540,7 @@ Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass cls, jlong file_id)
{
if (H5Fstart_swmr_write((hid_t)file_id) < 0)
h5libraryError(env);
@@ -554,7 +553,7 @@ Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass cls, jlong file_id)
{
if (H5Fstart_mdc_logging((hid_t)file_id) < 0)
h5libraryError(env);
@@ -580,7 +579,7 @@ Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status
- (JNIEnv *env, jclass cls, jlong file_id, jbooleanArray mdc_logging_status)
+ (JNIEnv *env, jclass cls, jlong file_id, jbooleanArray mdc_logging_status)
{
hbool_t is_enabled;
hbool_t is_currently_logging;
diff --git a/java/src/jni/h5gImp.c b/java/src/jni/h5gImp.c
index 41ec382..42c042a 100644
--- a/java/src/jni/h5gImp.c
+++ b/java/src/jni/h5gImp.c
@@ -30,7 +30,6 @@ extern "C" {
#include "h5gImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
/*
* Class: hdf_hdf5lib_H5
diff --git a/java/src/jni/h5iImp.c b/java/src/jni/h5iImp.c
index 47574ca..b8bd1cd 100644
--- a/java/src/jni/h5iImp.c
+++ b/java/src/jni/h5iImp.c
@@ -28,7 +28,6 @@ extern "C" {
#include "h5iImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
/*
* Class: hdf_hdf5lib_H5
diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c
index f1734fd..e1ec3bd 100644
--- a/java/src/jni/h5lImp.c
+++ b/java/src/jni/h5lImp.c
@@ -28,13 +28,17 @@ extern "C" {
#include "h5lImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
+
+typedef struct _cb_wrapper {
+ jobject visit_callback;
+ jobject op_data;
+} cb_wrapper;
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5L_iterate_cb(hid_t g_id, const char *name, const H5L_info_t *info, void *op_data);
+static herr_t H5L_iterate_cb(hid_t g_id, const char *name, const H5L_info_t *info, void *cb_data);
/*
* Class: hdf_hdf5lib_H5
@@ -541,7 +545,7 @@ Java_hdf_hdf5lib_H5_H5Lmove
static herr_t
H5L_iterate_cb
- (hid_t g_id, const char *name, const H5L_info_t *info, void *op_data)
+ (hid_t g_id, const char *name, const H5L_info_t *info, void *cb_data)
{
JNIEnv *cbenv;
jint status;
@@ -551,6 +555,9 @@ H5L_iterate_cb
jmethodID constructor;
jvalue args[5];
jobject cb_info_t = NULL;
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ void *op_data = (void *)wrapper->op_data;
+ jobject visit_callback = wrapper->visit_callback;
if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
@@ -600,15 +607,15 @@ Java_hdf_hdf5lib_H5_H5Lvisit
jobject callback_op, jobject op_data)
{
herr_t status = -1;
+ cb_wrapper wrapper = {callback_op, op_data};
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if ((op_data == NULL) || (callback_op == NULL)) {
h5nullArgument(env, "H5Lvisit: op_data or callback_op is NULL");
} /* end if */
else {
- status = H5Lvisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data);
+ status = H5Lvisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper);
if (status < 0)
h5libraryError(env);
} /* end else */
@@ -628,9 +635,9 @@ Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name
{
herr_t status = -1;
const char *lName;
+ cb_wrapper wrapper = {callback_op, op_data};
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if ((op_data == NULL) || (callback_op == NULL)) {
h5nullArgument(env, "H5Lvisit_by_name: op_data or callback_op is NULL");
@@ -638,7 +645,7 @@ Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name
else {
PIN_JAVA_STRING(name, lName);
if (lName != NULL) {
- status = H5Lvisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data, (hid_t)access_id);
+ status = H5Lvisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper, (hid_t)access_id);
UNPIN_JAVA_STRING(name, lName);
@@ -662,15 +669,15 @@ Java_hdf_hdf5lib_H5_H5Literate
{
hsize_t start_idx = (hsize_t)idx;
herr_t status = -1;
+ cb_wrapper wrapper = {callback_op, op_data};
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if ((op_data == NULL) || (callback_op == NULL)) {
h5nullArgument(env, "H5Literate: op_data or callback_op is NULL");
} /* end if */
else {
- status = H5Literate((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data);
+ status = H5Literate((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper);
if (status < 0)
h5libraryError(env);
@@ -694,7 +701,7 @@ Java_hdf_hdf5lib_H5_H5Literate_1by_1name
const char *lName;
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
+ cb_wrapper wrapper = {callback_op, op_data};
if ((op_data == NULL) || (callback_op == NULL)) {
h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL");
@@ -702,7 +709,7 @@ Java_hdf_hdf5lib_H5_H5Literate_1by_1name
else {
PIN_JAVA_STRING(name, lName);
if (lName != NULL) {
- status = H5Literate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data, (hid_t)access_id);
+ status = H5Literate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper, (hid_t)access_id);
UNPIN_JAVA_STRING(name, lName);
diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c
index 6093e46..1de505a 100644
--- a/java/src/jni/h5oImp.c
+++ b/java/src/jni/h5oImp.c
@@ -27,13 +27,17 @@ extern "C" {
#include "h5oImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
+
+typedef struct _cb_wrapper {
+ jobject visit_callback;
+ jobject op_data;
+} cb_wrapper;
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5O_iterate_cb(hid_t g_id, const char *name, const H5O_info_t *info, void *op_data);
+static herr_t H5O_iterate_cb(hid_t g_id, const char *name, const H5O_info_t *info, void *cb_data);
/*
* Class: hdf_hdf5lib_H5
@@ -330,7 +334,7 @@ Java_hdf_hdf5lib_H5_H5Olink
static herr_t
H5O_iterate_cb
- (hid_t g_id, const char *name, const H5O_info_t *info, void *op_data)
+ (hid_t g_id, const char *name, const H5O_info_t *info, void *cb_data)
{
JNIEnv *cbenv;
jint status = -1;
@@ -343,6 +347,9 @@ H5O_iterate_cb
jobject ihinfobuf1;
jobject ihinfobuf2;
jobject cb_info_t = NULL;
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ void *op_data = (void *)wrapper->op_data;
+ jobject visit_callback = wrapper->visit_callback;
if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) {
/* printf("JNI H5O_iterate_cb error: AttachCurrentThread failed\n"); */
@@ -448,9 +455,9 @@ Java_hdf_hdf5lib_H5_H5Ovisit
jobject callback_op, jobject op_data, jint fields)
{
herr_t status = -1;
+ cb_wrapper wrapper = {callback_op, op_data};
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if (op_data == NULL) {
h5nullArgument(env, "H5Ovisit: op_data is NULL");
@@ -459,7 +466,7 @@ Java_hdf_hdf5lib_H5_H5Ovisit
h5nullArgument(env, "H5Ovisit: callback_op is NULL");
} /* end if */
else {
- status = H5Ovisit2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (unsigned)fields);
+ status = H5Ovisit2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)&wrapper, (unsigned)fields);
if (status < 0)
h5libraryError(env);
@@ -480,9 +487,9 @@ Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name
{
herr_t status = -1;
const char *lName;
+ cb_wrapper wrapper = {callback_op, op_data};
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if (op_data == NULL) {
h5nullArgument(env, "H5Ovisit_by_name: op_data is NULL");
@@ -495,7 +502,7 @@ Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name
else {
PIN_JAVA_STRING(name, lName);
if (lName != NULL) {
- status = H5Ovisit_by_name2((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (unsigned)fields, (hid_t)access_id);
+ status = H5Ovisit_by_name2((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)&wrapper, (unsigned)fields, (hid_t)access_id);
UNPIN_JAVA_STRING(name, lName);
diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c
index 3ff7436..52008ce 100644
--- a/java/src/jni/h5pImp.c
+++ b/java/src/jni/h5pImp.c
@@ -27,7 +27,6 @@ extern "C" {
#include "h5pImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
extern jobject copy_callback;
extern jobject close_callback;
extern jobject create_callback;
@@ -36,6 +35,11 @@ extern jobject get_callback;
extern jobject set_callback;
extern jobject delete_callback;
+typedef struct _cb_wrapper {
+ jobject visit_callback;
+ jobject op_data;
+} cb_wrapper;
+
/********************/
/* Local Prototypes */
/********************/
@@ -52,7 +56,7 @@ static herr_t H5P_prp_get_func_cb(hid_t prop_id, const char *name, size_t size,
static herr_t H5P_prp_set_func_cb(hid_t prop_id, const char *name, size_t size, void *value);
static herr_t H5P_prp_delete_func_cb(hid_t prop_id, const char *name, size_t size, void *value);
-static herr_t H5P_iterate_cb(hid_t prop_id, const char *name, void *op_data);
+static herr_t H5P_iterate_cb(hid_t prop_id, const char *name, void *cb_data);
/*
* Class: hdf_hdf5lib_H5
@@ -3877,7 +3881,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi
const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0);
if (utf8) {
- member_name[i] = (char*)HDmalloc(strlen(utf8) + 1);
+ member_name[i] = (char*)HDmalloc(HDstrlen(utf8) + 1);
if (member_name[i]) {
strcpy(member_name[i], utf8);
} /* end if */
@@ -4185,7 +4189,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config
h5JNIFatalError(env, "H5Pset_mdc_config: out of memory trace_file_name");
return;
} /* end if */
- strncpy(cacheinfo.trace_file_name, str, 1025);
+ HDstrncpy(cacheinfo.trace_file_name, str, 1025);
ENVPTR->ReleaseStringUTFChars(ENVPAR j_str, str);
if(ENVPTR->ExceptionOccurred(ENVONLY)) {
h5JNIFatalError(env, "H5Pset_mdc_config: loading trace_file_name failed");
@@ -5042,7 +5046,7 @@ H5P_cls_copy_cb
} /* end if */
JVMPTR->DetachCurrentThread(JVMPAR);
return (herr_t)status;
-} /* end H5P_cls_ccopy_cb */
+} /* end H5P_cls_copy_cb */
static herr_t
H5P_cls_close_cb
@@ -5158,13 +5162,16 @@ Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options
static herr_t
H5D_append_cb
- (hid_t dataset_id, hsize_t *cur_dims, void *op_data)
+ (hid_t dataset_id, hsize_t *cur_dims, void *cb_data)
{
JNIEnv *cbenv;
jint status = -1;
jclass cls;
jmethodID mid;
jlongArray cur_dimsArray;
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ void *op_data = (void *)wrapper->op_data;
+ jobject visit_callback = wrapper->visit_callback;
if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) {
JVMPTR->DetachCurrentThread(JVMPAR);
@@ -5199,9 +5206,9 @@ Java_hdf_hdf5lib_H5_H5Pset_1append_1flush
(JNIEnv *env, jclass clss, jlong plist_id, jint ndims, jlongArray boundary, jobject callback_op, jobject op_data)
{
herr_t status = -1;
+ cb_wrapper wrapper = {callback_op, op_data};
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if (op_data == NULL) {
h5nullArgument(env, "H5Pset_append_flush: op_data is NULL");
@@ -5210,7 +5217,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1append_1flush
h5nullArgument(env, "H5Pset_append_flush: callback_op is NULL");
} /* end if */
else {
- status = H5Pset_append_flush((hid_t)plist_id, (unsigned)ndims, (const hsize_t*)boundary, (H5D_append_cb_t)H5D_append_cb, (void*)op_data);
+ status = H5Pset_append_flush((hid_t)plist_id, (unsigned)ndims, (const hsize_t*)boundary, (H5D_append_cb_t)H5D_append_cb, (void*)&wrapper);
if (status < 0)
h5libraryError(env);
@@ -5603,13 +5610,16 @@ Java_hdf_hdf5lib_H5_H5Pinsert2
static herr_t
H5P_iterate_cb
- (hid_t prop_id, const char *name, void *op_data)
+ (hid_t prop_id, const char *name, void *cb_data)
{
JNIEnv *cbenv;
jint status = -1;
jclass cls;
jmethodID mid;
jstring str;
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ void *op_data = (void *)wrapper->op_data;
+ jobject visit_callback = wrapper->visit_callback;
/* fprintf(stderr, "\nJNI H5P_iterate_cb entered\n"); fflush(stderr); */
if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) {
@@ -5656,9 +5666,9 @@ Java_hdf_hdf5lib_H5_H5Piterate
herr_t status = -1;
jint *theArray = NULL;
jboolean isCopy;
+ cb_wrapper wrapper = {callback_op, op_data};
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if (op_data == NULL) {
h5nullArgument(env, "H5Piterate: op_data is NULL");
@@ -5668,7 +5678,7 @@ Java_hdf_hdf5lib_H5_H5Piterate
} /* end else if */
else {
if (idx == NULL) {
- status = H5Piterate((hid_t)prop_id, NULL, (H5P_iterate_t)H5P_iterate_cb, (void*)op_data);
+ status = H5Piterate((hid_t)prop_id, NULL, (H5P_iterate_t)H5P_iterate_cb, (void*)&wrapper);
} /* end if */
else {
theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR idx, &isCopy);
@@ -5676,7 +5686,7 @@ Java_hdf_hdf5lib_H5_H5Piterate
h5JNIFatalError(env, "H5Piterate: idx not pinned");
} /* end if */
else
- status = H5Piterate((hid_t)prop_id, (int*)&theArray[0], (H5P_iterate_t)H5P_iterate_cb, (void*)op_data);
+ status = H5Piterate((hid_t)prop_id, (int*)&theArray[0], (H5P_iterate_t)H5P_iterate_cb, (void*)&wrapper);
} /* end else */
if (status < 0) {
diff --git a/java/src/jni/h5plImp.c b/java/src/jni/h5plImp.c
index ffd5b7a..d551120 100644
--- a/java/src/jni/h5plImp.c
+++ b/java/src/jni/h5plImp.c
@@ -27,7 +27,6 @@ extern "C" {
#include "h5plImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
/*
* Class: hdf_hdf5lib_H5
diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c
index b250550..5f2b86d 100644
--- a/java/src/jni/h5rImp.c
+++ b/java/src/jni/h5rImp.c
@@ -27,7 +27,6 @@ extern "C" {
#include "h5rImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
/*
diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c
index 10f69eb..65cdd7b 100644
--- a/java/src/jni/h5sImp.c
+++ b/java/src/jni/h5sImp.c
@@ -27,7 +27,6 @@ extern "C" {
#include "h5sImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
/*
* Class: hdf_hdf5lib_H5
@@ -572,7 +571,7 @@ Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple
h5JNIFatalError(env, "H5Pset_simple_extent: dims not pinned");
return -1;
} /* end if */
- sa = lp = (hsize_t *) malloc((size_t)rank * sizeof(hsize_t));
+ sa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t));
if (sa == NULL) {
ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
h5JNIFatalError(env, "H5Sset_simple_extent: dims not converted to hsize_t");
@@ -1018,7 +1017,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist
h5JNIFatalError(env, "H5Sget_select_hyper_blocklist: buf not pinned");
} /* end if */
else {
- ba = (hsize_t *) malloc((size_t)nb * 2 * (size_t)rank * sizeof(hsize_t));
+ ba = (hsize_t *) HDmalloc((size_t)nb * 2 * (size_t)rank * sizeof(hsize_t));
if (ba == NULL) {
ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT);
h5JNIFatalError(env, "H5Screate-simple: buffer not converted to hsize_t");
@@ -1136,7 +1135,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds
return -1;
} /* end if */
rank = (int) ENVPTR->GetArrayLength(ENVPAR start);
- strt = (hsize_t *)malloc((size_t)rank * sizeof(hsize_t));
+ strt = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
if (strt == NULL) {
ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
h5JNIFatalError(env, "H5Sget_select_bounds: start not converted to hsize_t");
diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c
index 7b4af56..307f1a5 100644
--- a/java/src/jni/h5tImp.c
+++ b/java/src/jni/h5tImp.c
@@ -30,7 +30,6 @@ extern "C" {
#include "h5tImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
/*
* Class: hdf_hdf5lib_H5
diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c
index 33dca7f..fd34ba1 100644
--- a/java/src/jni/h5util.c
+++ b/java/src/jni/h5util.c
@@ -33,7 +33,6 @@ hsize_t H5TOOLS_BUFSIZE = (32 * 1024 * 1024); /* 32 MB */
int H5TOOLS_TEXT_BLOCK = 16; /* Number of elements on a line in a text export file */
JavaVM *jvm;
-jobject visit_callback;
jobject copy_callback;
jobject close_callback;
jobject create_callback;
@@ -1769,7 +1768,7 @@ h5str_render_bin_output
if (H5Tis_variable_str(tid)) {
s = *(char**) mem;
if (s != NULL)
- size = strlen(s);
+ size = HDstrlen(s);
}
else {
s = (char *) mem;
@@ -2130,11 +2129,11 @@ render_bin_output_region_data_points
ret_value = -1;
HDfree(dims1);
- } /* end if((dims1 = (hsize_t *) malloc(sizeof(hsize_t) * ndims)) != NULL) */
+ } /* end if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */
else
ret_value = -1;
HDfree(region_buf);
- } /* end if((region_buf = malloc(type_size * (size_t)npoints)) != NULL) */
+ } /* end if((region_buf = HDmalloc(type_size * (size_t)npoints)) != NULL) */
else
ret_value = -1;
@@ -2437,7 +2436,7 @@ Java_hdf_hdf5lib_H5_H5AreadComplex
H5Tclose(p_type);
n = ENVPTR->GetArrayLength(ENVPAR buf);
- rdata = (char *)malloc((size_t)n * size);
+ rdata = (char *)HDmalloc((size_t)n * size);
if (rdata == NULL) {
h5JNIFatalError(env, "H5AreadComplex: failed to allocate buff for read");
} /* end if */
@@ -2953,7 +2952,7 @@ obj_info_all
if (retVal < 0) {
*(datainfo->otype+datainfo->count) = -1;
*(datainfo->ltype+datainfo->count) = -1;
- *(datainfo->objname+datainfo->count) = (char *)HDmalloc(strlen(name)+1);
+ *(datainfo->objname+datainfo->count) = (char *)HDmalloc(HDstrlen(name)+1);
HDstrcpy(*(datainfo->objname+datainfo->count), name);
*(datainfo->objno+datainfo->count) = (unsigned long)-1;
} /* end if */
diff --git a/java/test/TestH5.java b/java/test/TestH5.java
index 154390d..8fe4a56 100644
--- a/java/test/TestH5.java
+++ b/java/test/TestH5.java
@@ -162,7 +162,7 @@ public class TestH5 {
*/
@Test
public void testH5get_libversion() {
- int libversion[] = { 1, 10, 3 };
+ int libversion[] = { 1, 10, 4 };
try {
H5.H5get_libversion(libversion);
@@ -184,7 +184,7 @@ public class TestH5 {
*/
@Test
public void testH5check_version() {
- int majnum = 1, minnum = 10, relnum = 3;
+ int majnum = 1, minnum = 10, relnum = 4;
try {
H5.H5check_version(majnum, minnum, relnum);
diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java
index 656069a..59ff50e 100644
--- a/java/test/TestH5E.java
+++ b/java/test/TestH5E.java
@@ -37,6 +37,10 @@ import org.junit.rules.TestName;
public class TestH5E {
@Rule public TestName testname = new TestName();
+
+ public static final int ERRSTACK_CNT = 4;
+ public static final int ERRSTACK_MTY_CNT = 0;
+
long hdf_java_classid = -1;
long current_stackid = -1;
@@ -158,7 +162,7 @@ public class TestH5E {
fail("H5.H5Epop: " + err);
}
- assertTrue("H5.H5Epop #:" + num_msg, num_msg == 0);
+ assertTrue("H5.H5Epop #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT);
try {
num_msg = H5.H5Eget_num(current_stackid);
@@ -168,7 +172,7 @@ public class TestH5E {
fail("H5.H5Epop: " + err);
}
- assertTrue("H5.H5Epop #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Epop #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT);
try {
H5.H5Epop(current_stackid, 1);
@@ -186,7 +190,7 @@ public class TestH5E {
fail("H5.H5Epop: " + err);
}
- assertTrue("H5.H5Epop", num_msg == 3);
+ assertTrue("H5.H5Epop", num_msg == TestH5E.ERRSTACK_CNT - 1);
}
@Test
@@ -227,7 +231,7 @@ public class TestH5E {
try {
num_msg = H5.H5Eget_num(estack_id);
- assertTrue("testH5Epush #:" + num_msg, num_msg == 0);
+ assertTrue("testH5Epush #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -238,7 +242,7 @@ public class TestH5E {
try {
num_msg = H5.H5Eget_num(estack_id);
- assertTrue("testH5Epush #:" + num_msg, num_msg == 1);
+ assertTrue("testH5Epush #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT + 1);
}
catch (Throwable err) {
err.printStackTrace();
@@ -314,7 +318,7 @@ public class TestH5E {
err.printStackTrace();
fail("testH5Ewalk:H5Eget_num " + err);
}
- assertTrue("testH5Ewalk #:" + num_msg, num_msg == 4);
+ assertTrue("testH5Ewalk #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT);
try {
H5.H5Ewalk2(current_stackid, HDF5Constants.H5E_WALK_UPWARD, walk_cb, walk_data);
@@ -324,7 +328,7 @@ public class TestH5E {
fail("testH5Ewalk:H5Ewalk2 " + err);
}
assertFalse("testH5Ewalk:H5Ewalk2 ",((H5E_walk_data)walk_data).walkdata.isEmpty());
- assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size()==4);
+ assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size()==TestH5E.ERRSTACK_CNT);
}
}
diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java
index 5324d3a..a3057c6 100644
--- a/java/test/TestH5Edefault.java
+++ b/java/test/TestH5Edefault.java
@@ -29,6 +29,9 @@ import org.junit.rules.TestName;
public class TestH5Edefault {
@Rule public TestName testname = new TestName();
+ public static final int ERRSTACK_CNT = 4;
+ public static final int ERRSTACK_MTY_CNT = 0;
+
@Before
public void H5Eset_default_stack() {
assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
@@ -91,7 +94,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT);
//Save a copy of the current stack and clears the current stack
try {
@@ -122,7 +125,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
try {
H5.H5Eclose_stack(stack_id);
@@ -153,7 +156,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT);
//Save a copy of the current stack and clears the current stack
try {
@@ -174,7 +177,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 0);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_MTY_CNT);
//Verify the copy has the correct number of messages
try {
@@ -184,7 +187,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
//Generate errors on default stack
try {
@@ -202,7 +205,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT);
//Remove one message from the current stack
try {
@@ -213,7 +216,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == 3);
+ assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT - 1);
//Verify the copy still has the correct number of messages
try {
@@ -223,7 +226,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
}
@Test(expected = IllegalArgumentException.class)
@@ -293,7 +296,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
//Save a copy of the current stack
try {
@@ -314,7 +317,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
//Generate errors on default stack
try {
@@ -332,7 +335,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
//Remove one message from the current stack
try {
@@ -343,7 +346,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == 3);
+ assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT - 1);
//Verify the copy still has the correct number of messages
try {
@@ -353,7 +356,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
try {
H5.H5Eset_current_stack(stack_id);
@@ -363,7 +366,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
}
@Test(expected = IllegalArgumentException.class)
@@ -386,7 +389,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Epop: " + err);
}
- assertTrue("H5.H5Epop before #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Epop before #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
try {
H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1);
num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT);
@@ -395,7 +398,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Epop: " + err);
}
- assertTrue("H5.H5Epop after #:" + num_msg, num_msg == 3);
+ assertTrue("H5.H5Epop after #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT - 1);
}
@Test(expected = IllegalArgumentException.class)
@@ -471,7 +474,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eclear2_with_msg: " + err);
}
- assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
try {
H5.H5Eclear2(HDF5Constants.H5E_DEFAULT);
num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT);
@@ -480,7 +483,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eclear2_with_msg: " + err);
}
- assertTrue("H5.H5Eclear2_with_msg after #:" + num_msg, num_msg == 0);
+ assertTrue("H5.H5Eclear2_with_msg after #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_MTY_CNT);
}
@Test(expected = IllegalArgumentException.class)
@@ -516,7 +519,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_num: " + err);
}
- assertTrue("H5.H5Eget_num #:" + num_msg, num_msg == 0);
+ assertTrue("H5.H5Eget_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_MTY_CNT);
}
@Test
@@ -534,7 +537,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_num_with_msg: " + err);
}
- assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > 0);
+ assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > TestH5Edefault.ERRSTACK_MTY_CNT);
}
}
diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in
index 5d69bee..02d0147 100644
--- a/java/test/junit.sh.in
+++ b/java/test/junit.sh.in
@@ -59,11 +59,13 @@ LIST_LIBRARY_FILES="
$top_builddir/src/.libs/libhdf5.*
$top_builddir/java/src/jni/.libs/libhdf5_java.*
"
-LIST_JAR_FILES="
+LIST_JAR_TESTFILES="
$HDFLIB_HOME/hamcrest-core.jar
$HDFLIB_HOME/junit.jar
$HDFLIB_HOME/slf4j-api-1.7.25.jar
$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
+"
+LIST_JAR_FILES="
$top_builddir/java/src/$JARFILE
"
LIST_DATA_FILES="
@@ -109,6 +111,7 @@ $HDFTEST_HOME/testfiles/JUnit-TestH5Giterate.txt
# copy files from source dirs to test dir
#
COPY_LIBFILES="$LIST_LIBRARY_FILES"
+COPY_JARTESTFILES="$LIST_JAR_TESTFILES"
COPY_JARFILES="$LIST_JAR_FILES"
COPY_LIBFILES_TO_BLDLIBDIR()
@@ -138,6 +141,29 @@ COPY_LIBFILES_TO_BLDLIBDIR()
fi
done
# copy jar files. Used -f to make sure get a new copy
+ for tstfile in $COPY_JARTESTFILES
+ do
+ # ignore '#' comment
+ echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
+ RET=$?
+ if [ $RET -eq 1 ]; then
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $BLDLIBDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
for tstfile in $COPY_JARFILES
do
# ignore '#' comment
@@ -172,7 +198,10 @@ CLEAN_LIBFILES_AND_BLDLIBDIR()
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
- $RM $BLDLIBDIR
+ for tstfile in $COPY_JARTESTFILES
+ do
+ $RM $BLDLIBDIR/tstfile
+ done
fi
}
@@ -281,11 +310,6 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then
fi
case $os_name in
- Darwin)
- DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH
- export DYLD_LIBRARY_PATH
- LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
- ;;
*)
LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH
;;