summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2022-03-06 23:33:00 (GMT)
committerGitHub <noreply@github.com>2022-03-06 23:33:00 (GMT)
commit78375882485a99a81caa933928ed08d7a38ef88b (patch)
treef18c41d7794d546b6562dd2aa36932c78f00a16a /java
parent7e176db164d1a6f944e703c612c4952b15d333f4 (diff)
downloadhdf5-78375882485a99a81caa933928ed08d7a38ef88b.zip
hdf5-78375882485a99a81caa933928ed08d7a38ef88b.tar.gz
hdf5-78375882485a99a81caa933928ed08d7a38ef88b.tar.bz2
VFD SWMR: normalization with develop (#1472)
Much normalization with develop. Still needs tools changes wrt VFD plugins.
Diffstat (limited to 'java')
-rw-r--r--java/examples/datasets/H5Ex_D_Sofloat.java13
-rw-r--r--java/examples/datasets/H5Ex_D_UnlimitedMod.java2
-rw-r--r--java/examples/datasets/JavaDatasetExample.sh.in6
-rw-r--r--java/examples/datasets/Makefile.am2
-rw-r--r--java/examples/datatypes/H5Ex_T_ObjectReference.java275
-rw-r--r--java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java335
-rw-r--r--java/examples/datatypes/JavaDatatypeExample.sh.in6
-rw-r--r--java/examples/datatypes/Makefile.am2
-rw-r--r--java/examples/groups/H5Ex_G_Corder.java2
-rw-r--r--java/examples/groups/JavaGroupExample.sh.in6
-rw-r--r--java/examples/groups/Makefile.am2
-rw-r--r--java/examples/intro/JavaIntroExample.sh.in6
-rw-r--r--java/examples/intro/Makefile.am2
-rw-r--r--java/examples/testfiles/examples.datasets.H5Ex_D_Sofloat.txt8
-rw-r--r--java/lib/ext/slf4j-nop-1.7.25.jarbin4007 -> 0 bytes
-rw-r--r--java/lib/ext/slf4j-nop-1.7.33.jarbin0 -> 4020 bytes
-rw-r--r--java/lib/ext/slf4j-simple-1.7.25.jarbin15257 -> 0 bytes
-rw-r--r--java/lib/ext/slf4j-simple-1.7.33.jarbin0 -> 15400 bytes
-rw-r--r--java/lib/slf4j-api-1.7.25.jarbin41203 -> 0 bytes
-rw-r--r--java/lib/slf4j-api-1.7.33.jarbin0 -> 41473 bytes
-rw-r--r--java/src/Makefile.am2
-rw-r--r--java/src/hdf/hdf5lib/H5.java32
-rw-r--r--java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java2
-rw-r--r--java/src/hdf/hdf5lib/package-info.java4
-rw-r--r--java/src/hdf/hdf5lib/structs/H5F_info2_t.java2
-rw-r--r--java/src/jni/h5util.c157
-rw-r--r--java/test/CMakeLists.txt1
-rw-r--r--java/test/Makefile.am3
-rw-r--r--java/test/TestH5.java4
-rw-r--r--java/test/TestH5Ocopy.java300
-rw-r--r--java/test/TestH5OcopyOld.java397
-rw-r--r--java/test/TestH5P.java4
-rw-r--r--java/test/TestH5Pfapl.java8
-rw-r--r--java/test/TestH5Plist.java10
-rw-r--r--java/test/junit.sh.in28
-rw-r--r--java/test/testfiles/JUnit-TestH5Ocopy.txt3
-rw-r--r--java/test/testfiles/JUnit-TestH5OcopyOld.txt10
37 files changed, 1029 insertions, 605 deletions
diff --git a/java/examples/datasets/H5Ex_D_Sofloat.java b/java/examples/datasets/H5Ex_D_Sofloat.java
index a42aba4..8edde09 100644
--- a/java/examples/datasets/H5Ex_D_Sofloat.java
+++ b/java/examples/datasets/H5Ex_D_Sofloat.java
@@ -21,6 +21,9 @@
************************************************************/
package examples.datasets;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.util.Locale;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
@@ -123,8 +126,9 @@ public class H5Ex_D_Sofloat {
}
// Print the maximum value.
- System.out.println("Maximum value in write buffer is: " + max);
- System.out.println("Minimum value in write buffer is: " + min);
+ DecimalFormat df = new DecimalFormat("#,##0.000000", new DecimalFormatSymbols(Locale.US));
+ System.out.println("Maximum value in write buffer is: " + df.format(max));
+ System.out.println("Minimum value in write buffer is: " + df.format(min));
// Create a new file using the default properties.
try {
@@ -308,8 +312,9 @@ public class H5Ex_D_Sofloat {
}
// Print the maximum value.
- System.out.println("Maximum value in " + DATASETNAME + " is: " + max);
- System.out.println("Minimum value in " + DATASETNAME + " is: " + min);
+ DecimalFormat df = new DecimalFormat("#,##0.000000", new DecimalFormatSymbols(Locale.US));
+ System.out.println("Maximum value in " + DATASETNAME + " is: " + df.format(max));
+ System.out.println("Minimum value in " + DATASETNAME + " is: " + df.format(min));
// End access to the dataset and release resources used by it.
try {
diff --git a/java/examples/datasets/H5Ex_D_UnlimitedMod.java b/java/examples/datasets/H5Ex_D_UnlimitedMod.java
index 273ac3e..0708898 100644
--- a/java/examples/datasets/H5Ex_D_UnlimitedMod.java
+++ b/java/examples/datasets/H5Ex_D_UnlimitedMod.java
@@ -17,7 +17,7 @@
file. Next, it reopens the file, reads back the data,
outputs it to the screen, extends the dataset, and writes
new data to the entire extended dataset. Finally it
- reopens the file again, reads back the data, and utputs it
+ reopens the file again, reads back the data, and outputs it
to the screen.
************************************************************/
package examples.datasets;
diff --git a/java/examples/datasets/JavaDatasetExample.sh.in b/java/examples/datasets/JavaDatasetExample.sh.in
index f29739a..9a5ddd8 100644
--- a/java/examples/datasets/JavaDatasetExample.sh.in
+++ b/java/examples/datasets/JavaDatasetExample.sh.in
@@ -57,8 +57,8 @@ $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
+$HDFLIB_HOME/slf4j-api-1.7.33.jar
+$HDFLIB_HOME/ext/slf4j-simple-1.7.33.jar
"
LIST_DATA_FILES="
$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Alloc.txt
@@ -220,7 +220,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@
COPY_LIBFILES_TO_BLDLIBDIR
COPY_DATAFILES_TO_BLDDIR
-CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE""
+CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.33.jar:"$BLDLIBDIR"/slf4j-simple-1.7.33.jar:"$TESTJARFILE""
TEST=/usr/bin/test
if [ ! -x /usr/bin/test ]
diff --git a/java/examples/datasets/Makefile.am b/java/examples/datasets/Makefile.am
index 41a914b..8b71ced 100644
--- a/java/examples/datasets/Makefile.am
+++ b/java/examples/datasets/Makefile.am
@@ -27,7 +27,7 @@ classes:
pkgpath = examples/datasets
hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
-CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.25.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.25.jar:$$CLASSPATH
+CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.33.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.33.jar:$$CLASSPATH
jarfile = jar$(PACKAGE_TARNAME)datasets.jar
diff --git a/java/examples/datatypes/H5Ex_T_ObjectReference.java b/java/examples/datatypes/H5Ex_T_ObjectReference.java
index 38536b8..b0f98de 100644
--- a/java/examples/datatypes/H5Ex_T_ObjectReference.java
+++ b/java/examples/datatypes/H5Ex_T_ObjectReference.java
@@ -70,7 +70,7 @@ public class H5Ex_T_ObjectReference {
long group_id = HDF5Constants.H5I_INVALID_HID;
long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
- byte[][] dset_data = new byte[DIM0][8];
+ byte[][] dset_data = new byte[DIM0][HDF5Constants.H5R_REF_BUF_SIZE];
// Create a new file using default properties.
try {
@@ -111,50 +111,58 @@ public class H5Ex_T_ObjectReference {
e.printStackTrace();
}
- // Create references to the previously created objects. Passing -1
- // as space_id causes this parameter to be ignored. Other values
- // besides valid dataspaces result in an error.
try {
if (file_id >= 0) {
- byte rbuf0[] = H5.H5Rcreate(file_id, GROUPNAME, HDF5Constants.H5R_OBJECT, -1);
- byte rbuf1[] = H5.H5Rcreate(file_id, DATASETNAME2, HDF5Constants.H5R_OBJECT, -1);
- for (int indx = 0; indx < 8; indx++) {
- dset_data[0][indx] = rbuf0[indx];
- dset_data[1][indx] = rbuf1[indx];
+ try {
+ dset_data[0] = H5.H5Rcreate_object(file_id, GROUPNAME, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ }
+
+ try {
+ dset_data[1] = H5.H5Rcreate_object(file_id, DATASETNAME2, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
}
}
+
+ // Create dataspace. Setting maximum size to NULL sets the maximum
+ // size to be the current size.
+ try {
+ filespace_id = H5.H5Screate_simple(RANK, dims, null);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ // Create the dataset.
+ try {
+ if ((file_id >= 0) && (filespace_id >= 0))
+ dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_REF, filespace_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ // Write the object references to it.
+ try {
+ if (dataset_id >= 0)
+ H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
}
- catch (Exception e) {
- e.printStackTrace();
- }
-
- // Create dataspace. Setting maximum size to NULL sets the maximum
- // size to be the current size.
- try {
- filespace_id = H5.H5Screate_simple(RANK, dims, null);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- // Create the dataset.
- try {
- if ((file_id >= 0) && (filespace_id >= 0))
- dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_REF_OBJ, filespace_id,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- // Write the object references to it.
- try {
- if (dataset_id >= 0)
- H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF_OBJ, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data);
+ catch (Exception ex) {
+ ex.printStackTrace();
}
- catch (Exception e) {
- e.printStackTrace();
+ finally {
+ try {H5.H5Rdestroy(dset_data[1]);} catch (Exception ex) {}
+ try {H5.H5Rdestroy(dset_data[0]);} catch (Exception ex) {}
}
// End access to the dataset and release resources used by it.
@@ -192,140 +200,91 @@ public class H5Ex_T_ObjectReference {
int object_type = -1;
long object_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
- byte[][] dset_data;
+ byte[][] dset_data = new byte[DIM0][HDF5Constants.H5R_REF_BUF_SIZE];
// Open an existing file.
try {
file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- // Open an existing dataset.
- try {
- if (file_id >= 0)
- dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- // Get dataspace and allocate memory for read buffer.
- try {
- if (dataset_id >= 0)
- dataspace_id = H5.H5Dget_space(dataset_id);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- try {
- if (dataspace_id >= 0)
- H5.H5Sget_simple_extent_dims(dataspace_id, dims, null);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- // Allocate array of pointers to two-dimensional arrays (the
- // elements of the dataset.
- dset_data = new byte[(int)dims[0]][8];
-
- // Read the data using the default properties.
- try {
- if (dataset_id >= 0) {
- H5.H5Dread(dataset_id, HDF5Constants.H5T_STD_REF_OBJ, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data);
- }
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- // Output the data to the screen.
- for (int indx = 0; indx < dims[0]; indx++) {
- System.out.println(DATASETNAME + "[" + indx + "]:");
- System.out.print(" ->");
- // Open the referenced object, get its name and type.
+ // Open an existing dataset.
try {
- if (dataset_id >= 0) {
- object_id = H5.H5Rdereference(dataset_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, dset_data[indx]);
- object_type = H5.H5Rget_obj_type(dataset_id, HDF5Constants.H5R_OBJECT, dset_data[indx]);
- }
- String obj_name = null;
- if (object_type >= 0) {
- // Get the length of the name and retrieve the name.
- obj_name = H5.H5Iget_name(object_id);
- }
- if ((object_id >= 0) && (object_type >= -1)) {
- switch (H5G_obj.get(object_type)) {
- case H5G_GROUP:
- System.out.print("H5G_GROUP");
- try {
- if (object_id >= 0)
- H5.H5Gclose(object_id);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- break;
- case H5G_DATASET:
- System.out.print("H5G_DATASET");
+ dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT);
+
+ try {
+ // Get dataspace and allocate memory for read buffer.
+ dataspace_id = H5.H5Dget_space(dataset_id);
+ H5.H5Sget_simple_extent_dims(dataspace_id, dims, null);
+
+ // Read data.
+ H5.H5Dread(dataset_id, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data);
+
+ // Output the data to the screen.
+ for (int indx = 0; indx < dims[0]; indx++) {
+ System.out.println(DATASETNAME + "[" + indx + "]:");
+ System.out.print(" ->");
+ // Open the referenced object, get its name and type.
try {
- if (object_id >= 0)
- H5.H5Dclose(object_id);
+ object_id = H5.H5Ropen_object(dset_data[indx], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ try {
+ object_type = H5.H5Rget_obj_type3(dset_data[indx], HDF5Constants.H5R_OBJECT);
+ String obj_name = null;
+ if (object_type >= 0) {
+ // Get the name.
+ obj_name = H5.H5Iget_name(object_id);
+ }
+ if ((object_id >= 0) && (object_type >= -1)) {
+ switch (H5G_obj.get(object_type)) {
+ case H5G_GROUP:
+ System.out.print("H5G_GROUP");
+ break;
+ case H5G_DATASET:
+ System.out.print("H5G_DATASET");
+ break;
+ case H5G_TYPE:
+ System.out.print("H5G_TYPE");
+ break;
+ default:
+ System.out.print("UNHANDLED");
+ }
+ }
+ // Print the name.
+ System.out.println(": " + obj_name);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ finally {
+ try {H5.H5Oclose(object_id);} catch (Exception e) {}
+ }
}
- catch (Exception e) {
- e.printStackTrace();
+ catch (Exception e4) {
+ e4.printStackTrace();
}
- break;
- case H5G_TYPE:
- System.out.print("H5G_TYPE");
- try {
- if (object_id >= 0)
- H5.H5Tclose(object_id);
- }
- catch (Exception e) {
- e.printStackTrace();
+ finally {
+ try {H5.H5Rdestroy(dset_data[indx]);} catch (Exception e4) {}
}
- break;
- default:
- System.out.print("UNHANDLED");
- }
+ } // end for
+ }
+ catch (Exception e3) {
+ e3.printStackTrace();
+ }
+ finally {
+ try {H5.H5Sclose(dataspace_id);} catch (Exception e3) {}
}
- // Print the name.
- System.out.println(": " + obj_name);
}
- catch (Exception e) {
- e.printStackTrace();
+ catch (Exception e2) {
+ e2.printStackTrace();
+ }
+ finally {
+ try {H5.H5Dclose(dataset_id);} catch (Exception e2) {}
}
}
-
- // End access to the dataset and release resources used by it.
- try {
- if (dataspace_id >= 0)
- H5.H5Sclose(dataspace_id);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- try {
- if (dataset_id >= 0)
- H5.H5Dclose(dataset_id);
- }
- catch (Exception e) {
- e.printStackTrace();
+ catch (Exception e1) {
+ e1.printStackTrace();
}
-
- // Close the file.
- try {
- if (file_id >= 0)
- H5.H5Fclose(file_id);
- }
- catch (Exception e) {
- e.printStackTrace();
+ finally {
+ try {H5.H5Fclose(file_id);} catch (Exception e1) {}
}
}
diff --git a/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java b/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java
index b38b0a0..f61ae0d 100644
--- a/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java
+++ b/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java
@@ -18,7 +18,6 @@
Next, it reopens the file, dereferences the references,
and outputs the names of their targets to the screen.
************************************************************/
-
package examples.datatypes;
import java.util.EnumSet;
@@ -72,7 +71,7 @@ public class H5Ex_T_ObjectReferenceAttribute {
long dataset_id = HDF5Constants.H5I_INVALID_HID;
long attribute_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
- byte[][] dset_data = new byte[DIM0][8];
+ byte[][] dset_data = new byte[DIM0][HDF5Constants.H5R_REF_BUF_SIZE];
// Create a new file using default properties.
try {
@@ -86,7 +85,7 @@ public class H5Ex_T_ObjectReferenceAttribute {
// Create dataset with a scalar dataspace.
try {
dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR);
- if (dataspace_id >= 0) {
+ if ((file_id >= 0) && (dataspace_id >= 0)) {
dataset_id = H5.H5Dcreate(file_id, DATASETNAME2, HDF5Constants.H5T_STD_I32LE, dataspace_id,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
if (dataset_id >= 0)
@@ -113,64 +112,72 @@ public class H5Ex_T_ObjectReferenceAttribute {
e.printStackTrace();
}
- // Create references to the previously created objects. Passing -1
- // as space_id causes this parameter to be ignored. Other values
- // besides valid dataspaces result in an error.
try {
if (file_id >= 0) {
- byte rbuf0[] = H5.H5Rcreate(file_id, GROUPNAME, HDF5Constants.H5R_OBJECT, -1);
- byte rbuf1[] = H5.H5Rcreate(file_id, DATASETNAME2, HDF5Constants.H5R_OBJECT, -1);
- for (int indx = 0; indx < 8; indx++) {
- dset_data[0][indx] = rbuf0[indx];
- dset_data[1][indx] = rbuf1[indx];
+ try {
+ dset_data[0] = H5.H5Rcreate_object(file_id, GROUPNAME, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ }
+
+ try {
+ dset_data[1] = H5.H5Rcreate_object(file_id, DATASETNAME2, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
}
}
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- // Create dataset with a scalar dataspace to serve as the parent
- // for the attribute.
- try {
- dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR);
- if (dataspace_id >= 0) {
- dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- H5.H5Sclose(dataspace_id);
- dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ // Create dataset with a scalar dataspace to serve as the parent
+ // for the attribute.
+ try {
+ dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR);
+ if (dataspace_id >= 0) {
+ dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5.H5Sclose(dataspace_id);
+ dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ }
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ // Create dataspace. Setting maximum size to NULL sets the maximum
+ // size to be the current size.
+ try {
+ dataspace_id = H5.H5Screate_simple(RANK, dims, null);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ // Create the attribute and write the array data to it.
+ try {
+ if ((dataset_id >= 0) && (dataspace_id >= 0))
+ attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, HDF5Constants.H5T_STD_REF, dataspace_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ // Write the dataset.
+ try {
+ if (attribute_id >= 0)
+ H5.H5Awrite(attribute_id, HDF5Constants.H5T_STD_REF, dset_data);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
}
}
- catch (Exception e) {
- e.printStackTrace();
- }
-
- // Create dataspace. Setting maximum size to NULL sets the maximum
- // size to be the current size.
- try {
- dataspace_id = H5.H5Screate_simple(RANK, dims, null);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- // Create the attribute and write the array data to it.
- try {
- if ((dataset_id >= 0) && (dataspace_id >= 0))
- attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, HDF5Constants.H5T_STD_REF_OBJ, dataspace_id,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- // Write the dataset.
- try {
- if (attribute_id >= 0)
- H5.H5Awrite(attribute_id, HDF5Constants.H5T_STD_REF_OBJ, dset_data);
+ catch (Exception ex) {
+ ex.printStackTrace();
}
- catch (Exception e) {
- e.printStackTrace();
+ finally {
+ try {H5.H5Rdestroy(dset_data[1]);} catch (Exception ex) {}
+ try {H5.H5Rdestroy(dset_data[0]);} catch (Exception ex) {}
}
// End access to the dataset and release resources used by it.
@@ -190,7 +197,6 @@ public class H5Ex_T_ObjectReferenceAttribute {
e.printStackTrace();
}
- // Terminate access to the data space.
try {
if (dataspace_id >= 0)
H5.H5Sclose(dataspace_id);
@@ -207,7 +213,6 @@ public class H5Ex_T_ObjectReferenceAttribute {
catch (Exception e) {
e.printStackTrace();
}
-
}
private static void ReadDataset() {
@@ -218,158 +223,102 @@ public class H5Ex_T_ObjectReferenceAttribute {
int object_type = -1;
long object_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
- byte[][] dset_data;
+ byte[][] dset_data = new byte[DIM0][HDF5Constants.H5R_REF_BUF_SIZE];
// Open an existing file.
try {
file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- // Open an existing dataset.
- try {
- if (file_id >= 0)
- dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- try {
- if (dataset_id >= 0)
- attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- // Get dataspace and allocate memory for read buffer.
- try {
- if (attribute_id >= 0)
- dataspace_id = H5.H5Aget_space(attribute_id);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- try {
- if (dataspace_id >= 0)
- H5.H5Sget_simple_extent_dims(dataspace_id, dims, null);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- // Allocate array of pointers to two-dimensional arrays (the
- // elements of the dataset.
- dset_data = new byte[(int) dims[0]][8];
-
- // Read data.
- try {
- if (attribute_id >= 0)
- H5.H5Aread(attribute_id, HDF5Constants.H5T_STD_REF_OBJ, dset_data);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- // Output the data to the screen.
- for (int indx = 0; indx < dims[0]; indx++) {
- System.out.println(ATTRIBUTENAME + "[" + indx + "]:");
- System.out.print(" ->");
- // Open the referenced object, get its name and type.
+ // Open an existing dataset.
try {
- if (dataset_id >= 0) {
- object_id = H5.H5Rdereference(dataset_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, dset_data[indx]);
- object_type = H5.H5Rget_obj_type(dataset_id, HDF5Constants.H5R_OBJECT, dset_data[indx]);
+ dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT);
+
+ try {
+ attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
+
+ // Get dataspace and allocate memory for read buffer.
+ try {
+ dataspace_id = H5.H5Aget_space(attribute_id);
+ H5.H5Sget_simple_extent_dims(dataspace_id, dims, null);
+
+ // Read data.
+ H5.H5Aread(attribute_id, HDF5Constants.H5T_STD_REF, dset_data);
+
+ // Output the data to the screen.
+ for (int indx = 0; indx < dims[0]; indx++) {
+ System.out.println(ATTRIBUTENAME + "[" + indx + "]:");
+ System.out.print(" ->");
+ // Open the referenced object, get its name and type.
+ try {
+ object_id = H5.H5Ropen_object(dset_data[indx], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ try {
+ object_type = H5.H5Rget_obj_type3(dset_data[indx], HDF5Constants.H5R_OBJECT);
+ String obj_name = null;
+ if (object_type >= 0) {
+ // Get the name.
+ obj_name = H5.H5Iget_name(object_id);
+ }
+ if ((object_id >= 0) && (object_type >= -1)) {
+ switch (H5G_obj.get(object_type)) {
+ case H5G_GROUP:
+ System.out.print("H5G_GROUP");
+ break;
+ case H5G_DATASET:
+ System.out.print("H5G_DATASET");
+ break;
+ case H5G_TYPE:
+ System.out.print("H5G_TYPE");
+ break;
+ default:
+ System.out.print("UNHANDLED");
+ }
+ }
+ // Print the name.
+ System.out.println(": " + obj_name);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ finally {
+ try {H5.H5Oclose(object_id);} catch (Exception e) {}
+ }
+ }
+ catch (Exception e5) {
+ e5.printStackTrace();
+ }
+ finally {
+ try {H5.H5Rdestroy(dset_data[indx]);} catch (Exception e5) {}
+ }
+ } // end for
+ }
+ catch (Exception e4) {
+ e4.printStackTrace();
+ }
+ finally {
+ try {H5.H5Sclose(dataspace_id);} catch (Exception e3) {}
+ }
}
- String obj_name = null;
- if (object_type >= 0) {
- // Get the length of the name and retrieve the name.
- obj_name = H5.H5Iget_name(object_id);
+ catch (Exception e3) {
+ e3.printStackTrace();
}
- if ((object_id >= 0) && (object_type >= -1)) {
- switch (H5G_obj.get(object_type)) {
- case H5G_GROUP:
- System.out.print("H5G_GROUP");
- try {
- if (object_id >= 0)
- H5.H5Gclose(object_id);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- break;
- case H5G_DATASET:
- System.out.print("H5G_DATASET");
- try {
- if (object_id >= 0)
- H5.H5Dclose(object_id);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- break;
- case H5G_TYPE:
- System.out.print("H5G_TYPE");
- try {
- if (object_id >= 0)
- H5.H5Tclose(object_id);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- break;
- default:
- System.out.print("UNHANDLED");
- }
+ finally {
+ try {H5.H5Aclose(attribute_id);} catch (Exception e4) {}
}
- // Print the name.
- System.out.println(": " + obj_name);
}
- catch (Exception e) {
- e.printStackTrace();
+ catch (Exception e2) {
+ e2.printStackTrace();
+ }
+ finally {
+ try {H5.H5Dclose(dataset_id);} catch (Exception e2) {}
}
}
-
- // End access to the dataset and release resources used by it.
- try {
- if (attribute_id >= 0)
- H5.H5Aclose(attribute_id);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- try {
- if (dataset_id >= 0)
- H5.H5Dclose(dataset_id);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- // Terminate access to the data space.
- try {
- if (dataspace_id >= 0)
- H5.H5Sclose(dataspace_id);
+ catch (Exception e1) {
+ e1.printStackTrace();
}
- catch (Exception e) {
- e.printStackTrace();
+ finally {
+ try {H5.H5Fclose(file_id);} catch (Exception e1) {}
}
-
- // Close the file.
- try {
- if (file_id >= 0)
- H5.H5Fclose(file_id);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
}
public static void main(String[] args) {
diff --git a/java/examples/datatypes/JavaDatatypeExample.sh.in b/java/examples/datatypes/JavaDatatypeExample.sh.in
index e26d8c0..c6f5dbc 100644
--- a/java/examples/datatypes/JavaDatatypeExample.sh.in
+++ b/java/examples/datatypes/JavaDatatypeExample.sh.in
@@ -54,8 +54,8 @@ $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
+$HDFLIB_HOME/slf4j-api-1.7.33.jar
+$HDFLIB_HOME/ext/slf4j-simple-1.7.33.jar
"
LIST_DATA_FILES="
$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Array.txt
@@ -216,7 +216,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@
COPY_LIBFILES_TO_BLDLIBDIR
COPY_DATAFILES_TO_BLDDIR
-CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE""
+CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.33.jar:"$BLDLIBDIR"/slf4j-simple-1.7.33.jar:"$TESTJARFILE""
TEST=/usr/bin/test
if [ ! -x /usr/bin/test ]
diff --git a/java/examples/datatypes/Makefile.am b/java/examples/datatypes/Makefile.am
index 90790f7..55ff91f 100644
--- a/java/examples/datatypes/Makefile.am
+++ b/java/examples/datatypes/Makefile.am
@@ -27,7 +27,7 @@ classes:
pkgpath = examples/datatypes
hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
-CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.25.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.25.jar:$$CLASSPATH
+CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.33.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.33.jar:$$CLASSPATH
jarfile = jar$(PACKAGE_TARNAME)datatypes.jar
diff --git a/java/examples/groups/H5Ex_G_Corder.java b/java/examples/groups/H5Ex_G_Corder.java
index 5df850e..4fa5aa2 100644
--- a/java/examples/groups/H5Ex_G_Corder.java
+++ b/java/examples/groups/H5Ex_G_Corder.java
@@ -11,7 +11,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/************************************************************
Creating a file with creation properties and traverse the
- groups in alpabetical and creation order.
+ groups in alphabetical and creation order.
************************************************************/
package examples.groups;
diff --git a/java/examples/groups/JavaGroupExample.sh.in b/java/examples/groups/JavaGroupExample.sh.in
index 3b0e9d1..86f90bf 100644
--- a/java/examples/groups/JavaGroupExample.sh.in
+++ b/java/examples/groups/JavaGroupExample.sh.in
@@ -56,8 +56,8 @@ $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
+$HDFLIB_HOME/slf4j-api-1.7.33.jar
+$HDFLIB_HOME/ext/slf4j-simple-1.7.33.jar
"
LIST_ITER_FILES="
$HDFTEST_HOME/h5ex_g_iterate.h5
@@ -255,7 +255,7 @@ COPY_LIBFILES_TO_BLDLIBDIR
COPY_DATAFILES_TO_BLDDIR
COPY_ITERFILES_TO_BLDITERDIR
-CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE""
+CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.33.jar:"$BLDLIBDIR"/slf4j-simple-1.7.33.jar:"$TESTJARFILE""
TEST=/usr/bin/test
if [ ! -x /usr/bin/test ]
diff --git a/java/examples/groups/Makefile.am b/java/examples/groups/Makefile.am
index bfde9ae..c520860 100644
--- a/java/examples/groups/Makefile.am
+++ b/java/examples/groups/Makefile.am
@@ -27,7 +27,7 @@ classes:
pkgpath = examples/groups
hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
-CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.25.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.25.jar:$$CLASSPATH
+CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.33.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.33.jar:$$CLASSPATH
jarfile = jar$(PACKAGE_TARNAME)groups.jar
diff --git a/java/examples/intro/JavaIntroExample.sh.in b/java/examples/intro/JavaIntroExample.sh.in
index db741e5..a095f27 100644
--- a/java/examples/intro/JavaIntroExample.sh.in
+++ b/java/examples/intro/JavaIntroExample.sh.in
@@ -54,8 +54,8 @@ $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
+$HDFLIB_HOME/slf4j-api-1.7.33.jar
+$HDFLIB_HOME/ext/slf4j-simple-1.7.33.jar
"
LIST_DATA_FILES="
$HDFTEST_HOME/../testfiles/examples.intro.H5_CreateDataset.txt
@@ -205,7 +205,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@
COPY_LIBFILES_TO_BLDLIBDIR
COPY_DATAFILES_TO_BLDDIR
-CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE""
+CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.33.jar:"$BLDLIBDIR"/slf4j-simple-1.7.33.jar:"$TESTJARFILE""
TEST=/usr/bin/test
if [ ! -x /usr/bin/test ]
diff --git a/java/examples/intro/Makefile.am b/java/examples/intro/Makefile.am
index 7d1aeab..741f122 100644
--- a/java/examples/intro/Makefile.am
+++ b/java/examples/intro/Makefile.am
@@ -27,7 +27,7 @@ classes:
pkgpath = examples/intro
hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
-CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.25.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.25.jar:$$CLASSPATH
+CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.33.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.33.jar:$$CLASSPATH
jarfile = jar$(PACKAGE_TARNAME)intro.jar
diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Sofloat.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Sofloat.txt
index 4d4b5d6..9025ce2 100644
--- a/java/examples/testfiles/examples.datasets.H5Ex_D_Sofloat.txt
+++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Sofloat.txt
@@ -1,6 +1,6 @@
-Maximum value in write buffer is: 106.66666666666667
-Minimum value in write buffer is: 1.7692307692307692
+Maximum value in write buffer is: 106.666667
+Minimum value in write buffer is: 1.769231
Filter type is: H5Z_FILTER_SCALEOFFSET
-Maximum value in DS1 is: 106.66169811320755
-Minimum value in DS1 is: 1.7692307692307692
+Maximum value in DS1 is: 106.661698
+Minimum value in DS1 is: 1.769231
diff --git a/java/lib/ext/slf4j-nop-1.7.25.jar b/java/lib/ext/slf4j-nop-1.7.25.jar
deleted file mode 100644
index 78c7295..0000000
--- a/java/lib/ext/slf4j-nop-1.7.25.jar
+++ /dev/null
Binary files differ
diff --git a/java/lib/ext/slf4j-nop-1.7.33.jar b/java/lib/ext/slf4j-nop-1.7.33.jar
new file mode 100644
index 0000000..aa8fc09
--- /dev/null
+++ b/java/lib/ext/slf4j-nop-1.7.33.jar
Binary files differ
diff --git a/java/lib/ext/slf4j-simple-1.7.25.jar b/java/lib/ext/slf4j-simple-1.7.25.jar
deleted file mode 100644
index b29ca12..0000000
--- a/java/lib/ext/slf4j-simple-1.7.25.jar
+++ /dev/null
Binary files differ
diff --git a/java/lib/ext/slf4j-simple-1.7.33.jar b/java/lib/ext/slf4j-simple-1.7.33.jar
new file mode 100644
index 0000000..ebf4846
--- /dev/null
+++ b/java/lib/ext/slf4j-simple-1.7.33.jar
Binary files differ
diff --git a/java/lib/slf4j-api-1.7.25.jar b/java/lib/slf4j-api-1.7.25.jar
deleted file mode 100644
index 7e62f13..0000000
--- a/java/lib/slf4j-api-1.7.25.jar
+++ /dev/null
Binary files differ
diff --git a/java/lib/slf4j-api-1.7.33.jar b/java/lib/slf4j-api-1.7.33.jar
new file mode 100644
index 0000000..db3730d
--- /dev/null
+++ b/java/lib/slf4j-api-1.7.33.jar
Binary files differ
diff --git a/java/src/Makefile.am b/java/src/Makefile.am
index a0abb32..5bb72ad 100644
--- a/java/src/Makefile.am
+++ b/java/src/Makefile.am
@@ -36,7 +36,7 @@ jarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
hdf5_javadir = $(libdir)
pkgpath = hdf/hdf5lib
-CLASSPATH_ENV=CLASSPATH=.:$(top_srcdir)/java/lib/slf4j-api-1.7.25.jar:$$CLASSPATH
+CLASSPATH_ENV=CLASSPATH=.:$(top_srcdir)/java/lib/slf4j-api-1.7.33.jar:$$CLASSPATH
AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java
index 4129f50..3180ede 100644
--- a/java/src/hdf/hdf5lib/H5.java
+++ b/java/src/hdf/hdf5lib/H5.java
@@ -161,7 +161,7 @@ import hdf.hdf5lib.structs.H5O_token_t;
* disk (source) and in memory (destination).
* <p>
* For Java, this ``ANY'' is a problem, as the type of data must always be declared. Furthermore, multidimensional
- * arrays are definitely <i>not</i> layed out contiguously in memory. It would be infeasible to declare a separate
+ * arrays are definitely <i>not</i> laid out contiguously in memory. It would be infeasible to declare a separate
* routine for every combination of number type and dimensionality. For that reason, the
* <a href="./hdf.hdf5lib.HDFArray.html"><b>HDFArray</b></a> class is used to discover the type, shape, and size of the
* data array at run time, and to convert to and from a contiguous array of bytes in synchronized static native C order.
@@ -216,7 +216,7 @@ import hdf.hdf5lib.structs.H5O_token_t;
* exception handlers to print out the HDF-5 error stack.
* <hr>
*
- * @version HDF5 1.13.1 <BR>
+ * @version HDF5 1.13.2 <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>
@@ -239,7 +239,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, 13, 1 };
+ public final static int LIB_VERSION[] = { 1, 13, 2 };
/**
* add system property to load library by path
@@ -442,7 +442,7 @@ public class H5 implements java.io.Serializable {
/**
* Turn on error handling. By default, the C library prints the error stack of the HDF-5 C library on stdout. This
- * behavior may be reenabled by calling H5error_on().
+ * behavior may be re-enabled by calling H5error_on().
*/
public synchronized static native void H5error_on();
@@ -2097,7 +2097,7 @@ public class H5 implements java.io.Serializable {
* IN: Identifier for object to which attributes are attached; may be group, dataset, or named datatype.
* @param idx_type
* IN: The type of index specified by idx_type can be one of the following:
- * H5_INDEX_NAME An alpha-numeric index by attribute name.
+ * H5_INDEX_NAME An alphanumeric index by attribute name.
* H5_INDEX_CRT_ORDER An index by creation order.
* @param order
* IN: The order in which the index is to be traversed, as specified by order, can be one of the following:
@@ -2137,7 +2137,7 @@ public class H5 implements java.io.Serializable {
* IN: Name of object, relative to location.
* @param idx_type
* IN: The type of index specified by idx_type can be one of the following:
- * H5_INDEX_NAME An alpha-numeric index by attribute name.
+ * H5_INDEX_NAME An alphanumeric index by attribute name.
* H5_INDEX_CRT_ORDER An index by creation order.
* @param order
* IN: The order in which the index is to be traversed, as specified by order, can be one of the following:
@@ -4577,7 +4577,7 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException, NullPointerException;
/**
- * Given a mount point, H5Funmount dissassociates the mount point's file from the file mounted there.
+ * Given a mount point, H5Funmount disassociates the mount point's file from the file mounted there.
*
* @param loc_id
* The identifier for the location at which the specified file is to be unmounted.
@@ -5205,7 +5205,7 @@ public class H5 implements java.io.Serializable {
*/
/**
* retrieves information of all objects (recurvisely) under the group (name) located in the file or group specified
- * by loc_id upto maximum specified by objMax.
+ * by loc_id up to maximum specified by objMax.
*
* @param loc_id
* IN: File or group identifier
@@ -7182,7 +7182,7 @@ public class H5 implements java.io.Serializable {
* @param size
* IN: Size the property value.
* @param def_value
- * IN: Defaul value of the property
+ * IN: Default value of the property
*
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
@@ -7202,7 +7202,7 @@ public class H5 implements java.io.Serializable {
* @param size
* IN: Size the property value.
* @param value
- * IN: Defaul value of the property
+ * IN: Default value of the property
*
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
@@ -7245,7 +7245,7 @@ public class H5 implements java.io.Serializable {
* @param ocpl_id
* IN: : Object (dataset or group) creation property list identifier
* @param attributes
- * The maximun and minimum no. of attributes to be stored.
+ * The maximum and minimum no. of attributes to be stored.
*
* <pre>
* attributes[0] = The maximum number of attributes to be stored in compact storage
@@ -7353,7 +7353,7 @@ public class H5 implements java.io.Serializable {
* transfer property list. The FLAGS argument specifies certain
* general properties of the filter and is documented below.
* The CD_VALUES is an array of CD_NELMTS integers which are
- * auxiliary data for the filter. The integer vlues will be
+ * auxiliary data for the filter. The integer values will be
* stored in the dataset object header as part of the filter
* information.
*<p>
@@ -8054,9 +8054,9 @@ public class H5 implements java.io.Serializable {
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
* @exception NullPointerException
- * - aligment array is null.
+ * - alignment array is null.
* @exception IllegalArgumentException
- * - aligment array is invalid.
+ * - alignment array is invalid.
**/
public synchronized static native int H5Pget_alignment(long plist, long[] alignment) throws HDF5LibraryException,
NullPointerException, IllegalArgumentException;
@@ -8202,7 +8202,7 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException;
/**
- * H5Pget_gc_references Returns the current setting for the garbage collection refernces property from a file access
+ * H5Pget_gc_references Returns the current setting for the garbage collection references property from a file access
* property list.
*
* @param fapl_id
@@ -9254,7 +9254,7 @@ public class H5 implements java.io.Serializable {
* the raw data chunk cache on a per-datset basis.
*
* @param dapl_id
- * IN: Identifier of the datset access property list.
+ * IN: Identifier of the dataset access property list.
* @param rdcc_nslots
* IN: Number of elements (objects) in the raw data chunk cache.
* @param rdcc_nbytes
diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java
index 532355e..9f94882 100644
--- a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java
+++ b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java
@@ -114,7 +114,7 @@ public class HDF5LibraryException extends HDF5Exception {
return "special zero no error";
}
else if (err_code == HDF5Constants.H5E_UNINITIALIZED) {
- return "information is unitialized";
+ return "information is uninitialized";
}
else if (err_code == HDF5Constants.H5E_UNSUPPORTED) {
return "feature is unsupported";
diff --git a/java/src/hdf/hdf5lib/package-info.java b/java/src/hdf/hdf5lib/package-info.java
index 838a266..2863f5a 100644
--- a/java/src/hdf/hdf5lib/package-info.java
+++ b/java/src/hdf/hdf5lib/package-info.java
@@ -114,7 +114,7 @@
* disk (source) and in memory (destination).
* <p>
* For Java, this ``ANY'' is a problem, as the type of data must always be declared. Furthermore, multidimensional
- * arrays are definitely <i>not</i> layed out contiguously in memory. It would be infeasible to declare a separate
+ * arrays are definitely <i>not</i> laid out contiguously in memory. It would be infeasible to declare a separate
* routine for every combination of number type and dimensionality. For that reason, the
* <a href="./hdf.hdf5lib.HDFArray.html"><b>HDFArray</b></a> class is used to discover the type, shape, and size of the
* data array at run time, and to convert to and from a contiguous array of bytes in synchronized static native C order.
@@ -171,4 +171,4 @@
*
* <b>See also: <a href="http://hdfgroup.org/HDF5/"> http://hdfgroup.org/HDF5"</a></b>
**/
-package hdf.hdf5lib; \ No newline at end of file
+package hdf.hdf5lib;
diff --git a/java/src/hdf/hdf5lib/structs/H5F_info2_t.java b/java/src/hdf/hdf5lib/structs/H5F_info2_t.java
index f951bb4..78e6d6c 100644
--- a/java/src/hdf/hdf5lib/structs/H5F_info2_t.java
+++ b/java/src/hdf/hdf5lib/structs/H5F_info2_t.java
@@ -40,7 +40,7 @@ public class H5F_info2_t implements Serializable{
public H5_ih_info_t sohm_msgs_info;
/**
- * Constructor fot current "global" information about file
+ * Constructor for current "global" information about file
* @param super_version: Superblock version number
* @param super_size: Superblock size
* @param super_ext_size: Superblock extension size
diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c
index 7313c28..5a01dc9 100644
--- a/java/src/jni/h5util.c
+++ b/java/src/jni/h5util.c
@@ -182,7 +182,7 @@ size_t
h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_buf, size_t out_buf_offset)
{
unsigned char *ucptr = NULL;
- static char fmt_llong[8], fmt_ullong[8];
+ char fmt_llong[8], fmt_ullong[8];
H5T_class_t tclass = H5T_NO_CLASS;
const char delimiter[] = " ," H5_COMPOUND_BEGIN_INDICATOR H5_COMPOUND_END_INDICATOR
H5_ARRAY_BEGIN_INDICATOR H5_ARRAY_END_INDICATOR H5_VLEN_BEGIN_INDICATOR H5_VLEN_END_INDICATOR;
@@ -211,10 +211,10 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_
/* Build default formats for long long types */
if (!fmt_llong[0]) {
- if (HDsprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_convert: HDsprintf failure");
- if (HDsprintf(fmt_ullong, "%%%su", H5_PRINTF_LL_WIDTH) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_convert: HDsprintf failure");
+ if (HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%%sd", H5_PRINTF_LL_WIDTH) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_convert: HDsnprintf failure");
+ if (HDsnprintf(fmt_ullong, sizeof(fmt_ullong), "%%%su", H5_PRINTF_LL_WIDTH) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_convert: HDsnprintf failure");
} /* end if */
switch (tclass) {
@@ -759,7 +759,7 @@ size_t
h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *in_buf, int expand_data)
{
unsigned char *ucptr = (unsigned char *)in_buf;
- static char fmt_llong[8], fmt_ullong[8];
+ char fmt_llong[8], fmt_ullong[8];
H5T_class_t tclass = H5T_NO_CLASS;
size_t typeSize = 0;
H5T_sign_t nsign = H5T_SGN_ERROR;
@@ -794,11 +794,12 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i
HDmemcpy(&tmp_float, cptr, sizeof(float));
- if (NULL == (this_str = (char *)HDmalloc(25)))
+ size_t this_len = 25;
+ if (NULL == (this_str = (char *)HDmalloc(this_len)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
- if (HDsprintf(this_str, "%g", tmp_float) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ if (HDsnprintf(this_str, this_len, "%g", tmp_float) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
break;
}
@@ -808,11 +809,12 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i
HDmemcpy(&tmp_double, cptr, sizeof(double));
- if (NULL == (this_str = (char *)HDmalloc(25)))
+ size_t this_len = 25;
+ if (NULL == (this_str = (char *)HDmalloc(this_len)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
- if (HDsprintf(this_str, "%g", tmp_double) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ if (HDsnprintf(this_str, "%g", this_len, tmp_double) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
break;
}
@@ -822,11 +824,12 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i
HDmemcpy(&tmp_ldouble, cptr, sizeof(long double));
- if (NULL == (this_str = (char *)HDmalloc(27)))
+ size_t this_len = 27;
+ if (NULL == (this_str = (char *)HDmalloc(this_len)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
- if (HDsprintf(this_str, "%Lg", tmp_ldouble) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ if (HDsnprintf(this_str, this_len, "%Lg", tmp_ldouble) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
break;
}
@@ -888,25 +891,26 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i
unsigned char tmp_uchar = 0;
char tmp_char = 0;
+ size_t this_len = 7;
if (H5T_SGN_NONE == nsign) {
HDmemcpy(&tmp_uchar, cptr, sizeof(unsigned char));
- if (NULL == (this_str = (char *)HDmalloc(7)))
+ if (NULL == (this_str = (char *)HDmalloc(this_len)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY,
"h5str_sprintf: failed to allocate string buffer");
- if (HDsprintf(this_str, "%hhu", tmp_uchar) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ if (HDsnprintf(this_str, this_len, "%hhu", tmp_uchar) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
}
else {
HDmemcpy(&tmp_char, cptr, sizeof(char));
- if (NULL == (this_str = (char *)HDmalloc(7)))
+ if (NULL == (this_str = (char *)HDmalloc(this_len)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY,
"h5str_sprintf: failed to allocate string buffer");
- if (HDsprintf(this_str, "%hhd", tmp_char) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ if (HDsnprintf(this_str, this_len, "%hhd", tmp_char) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
}
break;
@@ -916,25 +920,26 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i
unsigned short tmp_ushort = 0;
short tmp_short = 0;
+ size_t this_len = 9;
if (H5T_SGN_NONE == nsign) {
HDmemcpy(&tmp_ushort, cptr, sizeof(unsigned short));
- if (NULL == (this_str = (char *)HDmalloc(9)))
+ if (NULL == (this_str = (char *)HDmalloc(this_len)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY,
"h5str_sprintf: failed to allocate string buffer");
- if (HDsprintf(this_str, "%hu", tmp_ushort) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ if (HDsnprintf(this_str, this_len, "%hu", tmp_ushort) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
}
else {
HDmemcpy(&tmp_short, cptr, sizeof(short));
- if (NULL == (this_str = (char *)HDmalloc(9)))
+ if (NULL == (this_str = (char *)HDmalloc(this_len)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY,
"h5str_sprintf: failed to allocate string buffer");
- if (HDsprintf(this_str, "%hd", tmp_short) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ if (HDsnprintf(this_str, this_len, "%hd", tmp_short) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
}
break;
@@ -944,25 +949,26 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i
unsigned int tmp_uint = 0;
int tmp_int = 0;
+ size_t this_len = 14;
if (H5T_SGN_NONE == nsign) {
HDmemcpy(&tmp_uint, cptr, sizeof(unsigned int));
- if (NULL == (this_str = (char *)HDmalloc(14)))
+ if (NULL == (this_str = (char *)HDmalloc(this_len)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY,
"h5str_sprintf: failed to allocate string buffer");
- if (HDsprintf(this_str, "%u", tmp_uint) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ if (HDsnprintf(this_str, this_len, "%u", tmp_uint) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
}
else {
HDmemcpy(&tmp_int, cptr, sizeof(int));
- if (NULL == (this_str = (char *)HDmalloc(14)))
+ if (NULL == (this_str = (char *)HDmalloc(this_len)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY,
"h5str_sprintf: failed to allocate string buffer");
- if (HDsprintf(this_str, "%d", tmp_int) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ if (HDsnprintf(this_str, this_len, "%d", tmp_int) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
}
break;
@@ -972,25 +978,26 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i
unsigned long tmp_ulong = 0;
long tmp_long = 0;
+ size_t this_len = 23;
if (H5T_SGN_NONE == nsign) {
HDmemcpy(&tmp_ulong, cptr, sizeof(unsigned long));
- if (NULL == (this_str = (char *)HDmalloc(23)))
+ if (NULL == (this_str = (char *)HDmalloc(this_len)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY,
"h5str_sprintf: failed to allocate string buffer");
- if (HDsprintf(this_str, "%lu", tmp_ulong) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ if (HDsnprintf(this_str, this_len, "%lu", tmp_ulong) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
}
else {
HDmemcpy(&tmp_long, cptr, sizeof(long));
- if (NULL == (this_str = (char *)HDmalloc(23)))
+ if (NULL == (this_str = (char *)HDmalloc(this_len)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY,
"h5str_sprintf: failed to allocate string buffer");
- if (HDsprintf(this_str, "%ld", tmp_long) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ if (HDsnprintf(this_str, this_len, "%ld", tmp_long) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
}
break;
@@ -1001,25 +1008,26 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i
unsigned long long tmp_ullong = 0;
long long tmp_llong = 0;
+ size_t this_len = 25;
if (H5T_SGN_NONE == nsign) {
HDmemcpy(&tmp_ullong, cptr, sizeof(unsigned long long));
- if (NULL == (this_str = (char *)HDmalloc(25)))
+ if (NULL == (this_str = (char *)HDmalloc(this_len)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY,
"h5str_sprintf: failed to allocate string buffer");
- if (HDsprintf(this_str, fmt_ullong, tmp_ullong) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ if (HDsnprintf(this_str, this_len, fmt_ullong, tmp_ullong) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
}
else {
HDmemcpy(&tmp_llong, cptr, sizeof(long long));
- if (NULL == (this_str = (char *)HDmalloc(25)))
+ if (NULL == (this_str = (char *)HDmalloc(this_len)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY,
"h5str_sprintf: failed to allocate string buffer");
- if (HDsprintf(this_str, fmt_llong, tmp_llong) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ if (HDsnprintf(this_str, this_len, fmt_llong, tmp_llong) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
}
break;
@@ -1079,17 +1087,18 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i
else {
size_t i;
- if (NULL == (this_str = (char *)HDmalloc(4 * (typeSize + 1))))
+ size_t this_len = 4 * (typeSize + 1);
+ if (NULL == (this_str = (char *)HDmalloc(this_len)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
if (1 == typeSize) {
- if (HDsprintf(this_str, "%#02x", ucptr[0]) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ if (HDsnprintf(this_str, this_len, "%#02x", ucptr[0]) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
}
else {
for (i = 0; i < typeSize; i++)
- if (HDsprintf(this_str, "%s%02x", i ? ":" : "", ucptr[i]) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ if (HDsnprintf(this_str, this_len, "%s%02x", i ? ":" : "", ucptr[i]) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
}
}
@@ -1134,11 +1143,12 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i
else
H5_LIBRARY_ERROR(ENVONLY);
- if (NULL == (this_str = (char *)HDmalloc(14)))
+ size_t this_len = 14;
+ if (NULL == (this_str = (char *)HDmalloc(this_len)))
H5_OUT_OF_MEMORY_ERROR(
ENVONLY, "h5str_sprintf: failed to allocate string buffer");
- if (HDsprintf(this_str, "%u-", (unsigned)oi.type) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ if (HDsnprintf(this_str, this_len, "%u-", (unsigned)oi.type) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
if (!h5str_append(out_str, this_str))
H5_ASSERTION_ERROR(ENVONLY, "Unable to append string.");
HDfree(this_str);
@@ -1150,11 +1160,13 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i
H5Otoken_to_str(tid, &oi.token, &token_str);
- if (NULL == (this_str = (char *)HDmalloc(64 + strlen(token_str) + 1)))
+ size_t this_len = 64 + strlen(token_str) + 1;
+ if (NULL == (this_str = (char *)HDmalloc(this_len)))
H5_OUT_OF_MEMORY_ERROR(
ENVONLY, "h5str_sprintf: failed to allocate string buffer");
- if (HDsprintf(this_str, "%lu:%s", oi.fileno, token_str) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ if (HDsnprintf(this_str, this_len, "%lu:%s", oi.fileno, token_str) <
+ 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
H5free_memory(token_str);
}
@@ -1307,17 +1319,18 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i
/* All other types get printed as hexadecimal */
- if (NULL == (this_str = (char *)HDmalloc(4 * (typeSize + 1))))
+ size_t this_len = 4 * (typeSize + 1);
+ if (NULL == (this_str = (char *)HDmalloc(this_len)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
if (1 == typeSize) {
- if (HDsprintf(this_str, "%#02x", ucptr[0]) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ if (HDsnprintf(this_str, this_len, "%#02x", ucptr[0]) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
}
else {
for (i = 0; i < typeSize; i++)
- if (HDsprintf(this_str, "%s%02x", i ? ":" : "", ucptr[i]) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ if (HDsnprintf(this_str, this_len, "%s%02x", i ? ":" : "", ucptr[i]) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
}
break;
@@ -1348,7 +1361,7 @@ done:
* This is a special case subfunction to print the data in a region reference of type blocks.
*
* Return:
- * The function returns FAIL if there was an error, otherwise SUCEED
+ * The function returns FAIL if there was an error, otherwise SUCCEED
*-------------------------------------------------------------------------
*/
static int
@@ -1519,8 +1532,9 @@ h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region_space, hid_t re
for (j = 0; j < ndims; j++) {
tmp_str[0] = '\0';
- if (HDsprintf(tmp_str, "%s%lu", j ? "," : "(", (unsigned long)ptdata[i * 2 * ndims + j]) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: HDsprintf failure");
+ if (HDsnprintf(tmp_str, sizeof(tmp_str), "%s%lu", j ? "," : "(",
+ (unsigned long)ptdata[i * 2 * ndims + j]) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: HDsnprintf failure");
if (!h5str_append(str, tmp_str))
H5_ASSERTION_ERROR(ENVONLY, "Unable to append string.");
@@ -1529,9 +1543,9 @@ h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region_space, hid_t re
for (j = 0; j < ndims; j++) {
tmp_str[0] = '\0';
- if (HDsprintf(tmp_str, "%s%lu", j ? "," : ")-(",
- (unsigned long)ptdata[i * 2 * ndims + j + ndims]) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: HDsprintf failure");
+ if (HDsnprintf(tmp_str, sizeof(tmp_str), "%s%lu", j ? "," : ")-(",
+ (unsigned long)ptdata[i * 2 * ndims + j + ndims]) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: HDsnprintf failure");
if (!h5str_append(str, tmp_str))
H5_ASSERTION_ERROR(ENVONLY, "Unable to append string.");
@@ -1696,8 +1710,9 @@ h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region_space, hid_t re
for (j = 0; j < ndims; j++) {
tmp_str[0] = '\0';
- if (HDsprintf(tmp_str, "%s%lu", j ? "," : "(", (unsigned long)(ptdata[i * ndims + j])) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_points: HDsprintf failure");
+ if (HDsnprintf(tmp_str, sizeof(tmp_str), "%s%lu", j ? "," : "(",
+ (unsigned long)(ptdata[i * ndims + j])) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_points: HDsnprintf failure");
if (!h5str_append(str, tmp_str))
H5_ASSERTION_ERROR(ENVONLY, "Unable to append string.");
@@ -1771,7 +1786,7 @@ done:
* Purpose: Recursive check for variable length string of a datatype.
*
* Return:
- * TRUE : type conatains any variable length string
+ * TRUE : type contains any variable length string
* FALSE : type doesn't contain any variable length string
* Negative value: error occur
*
@@ -2300,7 +2315,7 @@ done:
* This is a special case subfunction to print the data in a region reference of type blocks.
*
* Return:
- * The function returns FAIL if there was an error, otherwise SUCEED
+ * The function returns FAIL if there was an error, otherwise SUCCEED
*
*-------------------------------------------------------------------------
*/
diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt
index c6cf607..b1186a4 100644
--- a/java/test/CMakeLists.txt
+++ b/java/test/CMakeLists.txt
@@ -39,6 +39,7 @@ set (HDF5_JAVA_TEST_SOURCES
TestH5Oparams
TestH5Obasic
TestH5Ocreate
+ TestH5OcopyOld
TestH5Ocopy
TestH5PL
TestH5VL
diff --git a/java/test/Makefile.am b/java/test/Makefile.am
index ac3b619..4a6785d 100644
--- a/java/test/Makefile.am
+++ b/java/test/Makefile.am
@@ -27,7 +27,7 @@ classes:
pkgpath = test
hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
-CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/junit.jar:$(top_srcdir)/java/lib/hamcrest-core.jar:$(top_srcdir)/java/lib/slf4j-api-1.7.25.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.25.jar:$$CLASSPATH
+CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/junit.jar:$(top_srcdir)/java/lib/hamcrest-core.jar:$(top_srcdir)/java/lib/slf4j-api-1.7.33.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.33.jar:$$CLASSPATH
jarfile = jar$(PACKAGE_TARNAME)test.jar
@@ -71,6 +71,7 @@ noinst_JAVA = \
TestH5Oparams.java \
TestH5Obasic.java \
TestH5Ocreate.java \
+ TestH5OcopyOld.java \
TestH5Ocopy.java \
TestH5PL.java \
TestH5VL.java \
diff --git a/java/test/TestH5.java b/java/test/TestH5.java
index 1f81f09..168f28a 100644
--- a/java/test/TestH5.java
+++ b/java/test/TestH5.java
@@ -287,7 +287,7 @@ public class TestH5 {
*/
@Test
public void testH5get_libversion() {
- int libversion[] = { 1, 13, 1 };
+ int libversion[] = { 1, 13, 2 };
try {
H5.H5get_libversion(libversion);
@@ -326,7 +326,7 @@ public class TestH5 {
*/
@Test
public void testH5check_version() {
- int majnum = 1, minnum = 13, relnum = 1;
+ int majnum = 1, minnum = 13, relnum = 2;
try {
H5.H5check_version(majnum, minnum, relnum);
diff --git a/java/test/TestH5Ocopy.java b/java/test/TestH5Ocopy.java
index b3b1acd..821cad3 100644
--- a/java/test/TestH5Ocopy.java
+++ b/java/test/TestH5Ocopy.java
@@ -136,33 +136,46 @@ public class TestH5Ocopy {
@Test
public void testH5OcopyRefsAttr() {
long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
- byte rbuf0[]=null , rbuf1[] = null;
- byte[] dset_data = new byte[16];
+ byte[][] dset_data = new byte[2][HDF5Constants.H5R_REF_BUF_SIZE];
long attribute_id = HDF5Constants.H5I_INVALID_HID;
-
- try {
- rbuf0 = H5.H5Rcreate(H5fid, "/G1", HDF5Constants.H5R_OBJECT, -1);
- rbuf1 = H5.H5Rcreate(H5fid, "DS2", HDF5Constants.H5R_OBJECT, -1);
- //System.arraycopy(rbuf0, 0, dset_data, 0, 8);
- System.arraycopy(rbuf1, 0, dset_data, 8, 8);
- }
- catch (Exception ex) {
- fail("testH5OcopyRefsAttr: H5Rcreate failed");
- }
-
try {
- attribute_id = H5.H5Acreate(H5did2, "A1", HDF5Constants.H5T_STD_REF_OBJ, H5dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- assertTrue("testH5OcopyRefsAttr.H5Acreate: ", attribute_id >= 0);
- H5.H5Awrite(attribute_id, HDF5Constants.H5T_STD_REF_OBJ, dset_data);
-
- H5.H5Aclose(attribute_id);
+ try {
+ dset_data[0] = H5.H5Rcreate_object(H5fid, "/G1", HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5OcopyRefsAttr: H5Rcreate_object " + err);
+ }
+
+ try {
+ dset_data[1] = H5.H5Rcreate_object(H5fid, "DS2", HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5OcopyRefsAttr: H5Rcreate_object " + err);
+ }
+
+ try {
+ attribute_id = H5.H5Acreate(H5did2, "A1", HDF5Constants.H5T_STD_REF, H5dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ assertTrue("testH5OcopyRefsAttr.H5Acreate: ", attribute_id >= 0);
+ H5.H5Awrite(attribute_id, HDF5Constants.H5T_STD_REF, dset_data);
+
+ H5.H5Aclose(attribute_id);
+ }
+ catch (Exception ex) {
+ fail("testH5OcopyRefsAttr: H5Awrite failed");
+ }
+ finally {
+ try {H5.H5Aclose(attribute_id);} catch (Exception exx) {}
+ }
}
catch (Exception ex) {
- fail("testH5OcopyRefsAttr: H5Awrite failed");
+ ex.printStackTrace();
}
finally {
- try {H5.H5Aclose(attribute_id);} catch (Exception exx) {}
+ try {H5.H5Rdestroy(dset_data[1]);} catch (Exception ex) {}
+ try {H5.H5Rdestroy(dset_data[0]);} catch (Exception ex) {}
}
try {
@@ -181,30 +194,50 @@ public class TestH5Ocopy {
@Test
public void testH5OcopyRefsDatasettodiffFile() {
- byte rbuf1[] = null;
- byte[] dset_data = new byte[16];
+ byte[][] dset_data = new byte[2][HDF5Constants.H5R_REF_BUF_SIZE];
long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
long dataset_id = HDF5Constants.H5I_INVALID_HID;
long H5fid2 = HDF5Constants.H5I_INVALID_HID;
try {
- rbuf1 = H5.H5Rcreate(H5fid, "DS2", HDF5Constants.H5R_OBJECT, -1);
- System.arraycopy(rbuf1, 0, dset_data, 8, 8);
-
- dataset_id = H5.H5Dcreate(H5fid, "DSREF",
- HDF5Constants.H5T_STD_REF_OBJ, H5dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- assertTrue("testH5OcopyRefsDatasettodiffFile.H5Dcreate: ", dataset_id >= 0);
- H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF_OBJ,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data);
- H5.H5Dclose(dataset_id);
+ try {
+ dset_data[0] = H5.H5Rcreate_object(H5fid, "/G1", HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5OcopyRefsDatasettodiffFile: H5Rcreate_object " + err);
+ }
+ try {
+ dset_data[1] = H5.H5Rcreate_object(H5fid, "DS2", HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5OcopyRefsDatasettodiffFile: H5Rcreate_object " + err);
+ }
+
+ try {
+ dataset_id = H5.H5Dcreate(H5fid, "DSREF",
+ HDF5Constants.H5T_STD_REF, H5dsid,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ assertTrue("testH5OcopyRefsDatasettodiffFile.H5Dcreate: ", dataset_id >= 0);
+ H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF,
+ HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data);
+ H5.H5Dclose(dataset_id);
+ }
+ catch (Exception ex) {
+ fail("testH5OcopyRefsDatasettodiffFile: create dataset failed");
+ }
+ finally {
+ try {H5.H5Dclose(dataset_id);} catch (Exception exx) {}
+ }
}
catch (Exception ex) {
- fail("testH5OcopyRefsDatasettodiffFile: create dataset failed");
+ ex.printStackTrace();
}
finally {
- try {H5.H5Dclose(dataset_id);} catch (Exception exx) {}
+ try {H5.H5Rdestroy(dset_data[0]);} catch (Exception ex) {}
+ try {H5.H5Rdestroy(dset_data[1]);} catch (Exception ex) {}
}
try {
@@ -241,123 +274,154 @@ public class TestH5Ocopy {
@Test
public void testH5OcopyRefsDatasettosameFile() {
- byte rbuf0[]=null , rbuf1[] = null;
- byte[] dset_data = new byte[16];
+ byte[][] dset_data = new byte[2][HDF5Constants.H5R_REF_BUF_SIZE];
+ byte[][] read_data = new byte[2][HDF5Constants.H5R_REF_BUF_SIZE];
long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
long dataset_id = HDF5Constants.H5I_INVALID_HID;
long did = HDF5Constants.H5I_INVALID_HID;
int obj_type = -1;
- byte[] read_data = new byte[16];
try {
- rbuf0 = H5.H5Rcreate(H5fid, "/G1", HDF5Constants.H5R_OBJECT, -1);
- rbuf1 = H5.H5Rcreate(H5fid, "DS2", HDF5Constants.H5R_OBJECT, -1);
- System.arraycopy(rbuf0, 0, dset_data, 0, 8);
- System.arraycopy(rbuf1, 0, dset_data, 8, 8);
-
- //Create a dataset and write object references to it.
- dataset_id = H5.H5Dcreate(H5fid, "DSREF",
- HDF5Constants.H5T_STD_REF_OBJ, H5dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- assertTrue("testH5OcopyRefsDatasettosameFile.H5Dcreate: ", dataset_id >= 0);
- H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF_OBJ,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data);
- //Close the dataset.
- H5.H5Dclose(dataset_id);
+ try {
+ dset_data[0] = H5.H5Rcreate_object(H5fid, "/G1", HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5OcopyRefsDatasettosameFile: H5Rcreate_object " + err);
+ }
+
+ try {
+ dset_data[1] = H5.H5Rcreate_object(H5fid, "DS2", HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5OcopyRefsDatasettosameFile: H5Rcreate_object " + err);
+ }
+
+ try {
+ //Create a dataset and write object references to it.
+ dataset_id = H5.H5Dcreate(H5fid, "DSREF",
+ HDF5Constants.H5T_STD_REF, H5dsid,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ assertTrue("testH5OcopyRefsDatasettosameFile.H5Dcreate: ", dataset_id >= 0);
+ H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF,
+ HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data);
+ //Close the dataset.
+ H5.H5Dclose(dataset_id);
+ }
+ catch (Exception ex) {
+ fail("testH5OcopyRefsDatasettosameFile: create dataset failed");
+ }
+ finally {
+ try {H5.H5Dclose(dataset_id);} catch (Exception exx) {}
+ }
}
catch (Exception ex) {
- try {H5.H5Dclose(dataset_id);} catch (Exception exx) {}
- fail("testH5OcopyRefsDatasettosameFile: create dataset failed");
+ ex.printStackTrace();
+ }
+ finally {
+ try {H5.H5Rdestroy(dset_data[1]);} catch (Exception ex) {}
+ try {H5.H5Rdestroy(dset_data[0]);} catch (Exception ex) {}
}
try {
ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY);
assertTrue("testH5OcopyRefsDatasettosameFile.H5Pcreate: ", ocp_plist_id >= 0);
H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG);
+ //Perform copy function.
+ try {
+ H5.H5Ocopy(H5fid, "DSREF", H5fid, "CPYREFD", ocp_plist_id, HDF5Constants.H5P_DEFAULT);
+ }
+ catch(Exception ex) {
+ fail("testH5OcopyRefsDatasettosameFile: H5Ocopy failed");
+ }
}
catch (Exception ex) {
- try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {}
fail("testH5OcopyRefsDatasettosameFile: H5Pset_copy_object failed");
}
-
- //Perform copy function.
- try {
- H5.H5Ocopy(H5fid, "DSREF", H5fid, "CPYREFD", ocp_plist_id, HDF5Constants.H5P_DEFAULT);
- }
- catch(Exception ex) {
+ finally {
try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {}
- fail("testH5OcopyRefsDatasettosameFile: H5Ocopy failed");
}
- //Open the dataset that has been copied
try {
- did = H5.H5Dopen(H5fid, "DSREF", HDF5Constants.H5P_DEFAULT);
- assertTrue("testH5OcopyRefsDatasettosameFile.H5Dopen: ", did >= 0);
+ //Open the dataset that has been copied
+ try {
+ did = H5.H5Dopen(H5fid, "DSREF", HDF5Constants.H5P_DEFAULT);
+ assertTrue("testH5OcopyRefsDatasettosameFile.H5Dopen: ", did >= 0);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ fail("testH5OcopyRefsDatasettosameFile: H5Dopen failed");
+ }
+
+ //Read the dataset object references in the read_data buffer.
+ try {
+ H5.H5Dread(did, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL,HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, read_data);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ fail("testH5OcopyRefsDatasettosameFile: H5Dread failed");
+ }
}
- catch (Exception e) {
- try {H5.H5Dclose(did);} catch (Exception exx) {}
- e.printStackTrace();
- fail("testH5OcopyRefsDatasettosameFile: H5Dopen failed");
+ catch (Exception ex) {
+ ex.printStackTrace();
+ fail("testH5OcopyRefsDatasettosameFile: open and read dataset failed");
+ }
+ finally {
+ try {H5.H5Dclose(did);} catch (Exception ex) {}
}
try {
- //Read the dataset object references in the read_data buffer.
- H5.H5Dread(did, HDF5Constants.H5T_STD_REF_OBJ, HDF5Constants.H5S_ALL,HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, read_data);
- System.arraycopy(read_data, 0, rbuf0, 0, 8);
- System.arraycopy(read_data, 8, rbuf1, 0, 8);
-
//Get the type of object the reference points to.
- obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, rbuf1);
+ obj_type = H5.H5Rget_obj_type3(read_data[1], HDF5Constants.H5R_OBJECT);
assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET);
-
- obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, rbuf0);
+
+ obj_type = H5.H5Rget_obj_type3(read_data[0], HDF5Constants.H5R_OBJECT);
assertEquals(obj_type, HDF5Constants.H5O_TYPE_GROUP);
}
catch (Exception ex) {
ex.printStackTrace();
}
finally {
- try {H5.H5Dclose(did);} catch (Exception ex) {}
- try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {}
+ try {H5.H5Rdestroy(read_data[1]);} catch (Exception ex) {}
+ try {H5.H5Rdestroy(read_data[0]);} catch (Exception ex) {}
+ }
+ }
+
+ @Test
+ public void testH5OcopyNullRef() throws Throwable {
+ final long _pid_ = HDF5Constants.H5P_DEFAULT;
+ long sid = HDF5Constants.H5I_INVALID_HID;
+ long did = HDF5Constants.H5I_INVALID_HID;
+ long aid = HDF5Constants.H5I_INVALID_HID;
+
+ try {
+ sid = H5.H5Screate_simple(1, new long[] {1}, null);
+ assertTrue("testH5OcopyNullRef.H5Screate_simple: ", sid >= 0);
+ did = H5.H5Dcreate(H5fid, "Dataset_with_null_Ref", HDF5Constants.H5T_NATIVE_INT, sid, _pid_, _pid_, _pid_);
+ assertTrue("testH5OcopyNullRef.H5Dcreate: ", did > 0);
+ aid = H5.H5Acreate(did, "Null_Ref", HDF5Constants.H5T_STD_REF, sid, _pid_, _pid_);
+ assertTrue("testH5OcopyNullRef.H5Acreate: ", aid > 0);
}
- }
-
-// @Ignore because of JIRA HDF5-9547
-// @Test(expected = HDF5LibraryException.class)
-// public void testH5OcopyInvalidRef() throws Throwable {
-// final long _pid_ = HDF5Constants.H5P_DEFAULT;
-// long sid = HDF5Constants.H5I_INVALID_HID;
-// long did = HDF5Constants.H5I_INVALID_HID;
-// long aid = HDF5Constants.H5I_INVALID_HID;
-//
-// try {
-// sid = H5.H5Screate_simple(1, new long[] {1}, null);
-// assertTrue("testH5OcopyInvalidRef.H5Screate_simple: ", sid >= 0);
-// did = H5.H5Dcreate(H5fid, "Dataset_with_invalid_Ref", HDF5Constants.H5T_NATIVE_INT, sid, _pid_, _pid_, _pid_);
-// assertTrue("testH5OcopyInvalidRef.H5Dcreate: ", did > 0);
-// aid = H5.H5Acreate(did, "Invalid_Ref", HDF5Constants.H5T_STD_REF_OBJ, sid, _pid_, _pid_);
-// assertTrue("testH5OcopyInvalidRef.H5Acreate: ", aid > 0);
-// H5.H5Awrite(aid, HDF5Constants.H5T_STD_REF_OBJ, new long[]{-1});
-// }
-// catch (Exception ex) {
-// ex.printStackTrace();
-// }
-// finally {
-// try {H5.H5Dclose(did);} catch (Exception exx) {}
-// try {H5.H5Aclose(aid);} catch (Exception exx) {}
-// try {H5.H5Sclose(sid);} catch (Exception exx) {}
-// }
-//
-// long ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY);
-// assertTrue("testH5OcopyInvalidRef.H5Pcreate: ", ocp_plist_id >= 0);
-// H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG);
-// try {
-// H5.H5Ocopy(H5fid, "/Dataset_with_invalid_Ref", H5fid, "/Dataset_with_invalid_Ref_cp", ocp_plist_id, _pid_);
-// }
-// finally {
-// try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {}
-// }
-// }
+ catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ finally {
+ try {H5.H5Dclose(did);} catch (Exception exx) {}
+ try {H5.H5Aclose(aid);} catch (Exception exx) {}
+ try {H5.H5Sclose(sid);} catch (Exception exx) {}
+ }
+
+ long ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY);
+ assertTrue("testH5OcopyNullRef.H5Pcreate: ", ocp_plist_id >= 0);
+ H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG);
+ try {
+ H5.H5Ocopy(H5fid, "/Dataset_with_null_Ref", H5fid, "/Dataset_with_null_Ref_cp", ocp_plist_id, _pid_);
+ }
+ finally {
+ try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {}
+ }
+ }
}
diff --git a/java/test/TestH5OcopyOld.java b/java/test/TestH5OcopyOld.java
new file mode 100644
index 0000000..e547051
--- /dev/null
+++ b/java/test/TestH5OcopyOld.java
@@ -0,0 +1,397 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+
+import hdf.hdf5lib.H5;
+import hdf.hdf5lib.HDF5Constants;
+import hdf.hdf5lib.exceptions.HDF5Exception;
+import hdf.hdf5lib.exceptions.HDF5LibraryException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+
+public class TestH5OcopyOld {
+ @Rule public TestName testname = new TestName();
+ private static final String FILENAME = "testRefsattributeO.h5";
+ private static final int DIM_X = 4;
+ private static final int DIM_Y = 6;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did1 = HDF5Constants.H5I_INVALID_HID;
+ long H5did2 = HDF5Constants.H5I_INVALID_HID;
+ long H5gcpl = HDF5Constants.H5I_INVALID_HID;
+ long H5gid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid2 = HDF5Constants.H5I_INVALID_HID;
+ long[] dims = { 2 };
+
+ private final void _deleteFile(String filename) {
+ File file = new File(filename);
+
+ if (file.exists()) {
+ try {
+ file.delete();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private final long _createDataset(long fid, long dsid, String name, long dapl) {
+ long did = HDF5Constants.H5I_INVALID_HID;
+ try {
+ did = H5.H5Dcreate(fid, name,
+ HDF5Constants.H5T_STD_I32BE, dsid,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Dcreate: " + err);
+ }
+ assertTrue("TestH5O._createDataset: ",did >= 0);
+
+ return did;
+ }
+
+ private final long _createGroup(long fid, String name) {
+ long gid = HDF5Constants.H5I_INVALID_HID;
+ try {
+ H5gcpl = HDF5Constants.H5P_DEFAULT;
+ gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
+ H5gcpl, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Gcreate: " + err);
+ }
+ assertTrue("TestH5O._createGroup: ",gid >= 0);
+
+ return gid;
+ }
+
+ @Before
+ public void createH5file()
+ throws NullPointerException, HDF5Exception {
+ assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ System.out.print(testname.getMethodName());
+ try {
+ H5fid = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5dsid2 = H5.H5Screate(HDF5Constants.H5S_SCALAR);
+ H5did1 = _createDataset(H5fid, H5dsid2, "DS2", HDF5Constants.H5P_DEFAULT);
+ H5dsid = H5.H5Screate_simple(1, dims, null);
+ H5gid = _createGroup(H5fid, "/G1");
+ H5did2 = _createDataset(H5gid, H5dsid, "DS1", HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5O.createH5file: " + err);
+ }
+ assertTrue("TestH5O.createH5file: H5.H5Fcreate: ",H5fid >= 0);
+ assertTrue("TestH5O.createH5file: H5.H5Screate_simple: ",H5dsid >= 0);
+ assertTrue("TestH5O.createH5file: H5.H5Gcreate: ",H5gid >= 0);
+
+ H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
+ }
+
+ @After
+ public void deleteH5file() throws HDF5LibraryException {
+ if (H5gid > 0)
+ try {H5.H5Gclose(H5gid);} catch (Exception ex) {}
+ if (H5did2 > 0)
+ try {H5.H5Dclose(H5did2);} catch (Exception ex) {}
+ if (H5dsid > 0)
+ try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
+ if (H5dsid2 > 0)
+ try {H5.H5Sclose(H5dsid2);} catch (Exception ex) {}
+ if (H5did1 > 0)
+ try {H5.H5Dclose(H5did1);} catch (Exception ex) {}
+ if (H5fid > 0)
+ try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+
+ _deleteFile(FILENAME);
+ System.out.println();
+ }
+
+ @Test
+ public void testH5OcopyRefsAttr() {
+ long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
+ byte rbuf0[]=null , rbuf1[] = null;
+ byte[] dset_data = new byte[16];
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
+
+ try {
+ rbuf0 = H5.H5Rcreate(H5fid, "/G1", HDF5Constants.H5R_OBJECT, -1);
+ rbuf1 = H5.H5Rcreate(H5fid, "DS2", HDF5Constants.H5R_OBJECT, -1);
+ //System.arraycopy(rbuf0, 0, dset_data, 0, 8);
+ System.arraycopy(rbuf1, 0, dset_data, 8, 8);
+ }
+ catch (Exception ex) {
+ fail("testH5OcopyRefsAttr: H5Rcreate failed");
+ }
+
+ try {
+ attribute_id = H5.H5Acreate(H5did2, "A1", HDF5Constants.H5T_STD_REF_OBJ, H5dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ assertTrue("testH5OcopyRefsAttr.H5Acreate: ", attribute_id >= 0);
+ H5.H5Awrite(attribute_id, HDF5Constants.H5T_STD_REF_OBJ, dset_data);
+
+ H5.H5Aclose(attribute_id);
+ }
+ catch (Exception ex) {
+ fail("testH5OcopyRefsAttr: H5Awrite failed");
+ }
+ finally {
+ try {H5.H5Aclose(attribute_id);} catch (Exception exx) {}
+ }
+
+ try {
+ ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY);
+ assertTrue("testH5OcopyRefsAttr.H5Pcreate: ", ocp_plist_id >= 0);
+ H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG);
+ H5.H5Ocopy(H5fid, ".", H5fid, "CPYREF", ocp_plist_id, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Exception ex) {
+ fail("testH5OcopyRefsAttr: H5Ocopy failed");
+ }
+ finally {
+ try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {}
+ }
+ }
+
+ @Test
+ public void testH5OcopyRefsDatasettodiffFile() {
+ byte rbuf1[] = null;
+ byte[] dset_data = new byte[16];
+ long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long H5fid2 = HDF5Constants.H5I_INVALID_HID;
+
+ try {
+ rbuf1 = H5.H5Rcreate(H5fid, "DS2", HDF5Constants.H5R_OBJECT, -1);
+ System.arraycopy(rbuf1, 0, dset_data, 8, 8);
+
+ dataset_id = H5.H5Dcreate(H5fid, "DSREF",
+ HDF5Constants.H5T_STD_REF_OBJ, H5dsid,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ assertTrue("testH5OcopyRefsDatasettodiffFile.H5Dcreate: ", dataset_id >= 0);
+ H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF_OBJ,
+ HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data);
+ H5.H5Dclose(dataset_id);
+ }
+ catch (Exception ex) {
+ fail("testH5OcopyRefsDatasettodiffFile: create dataset failed");
+ }
+ finally {
+ try {H5.H5Dclose(dataset_id);} catch (Exception exx) {}
+ }
+
+ try {
+ //create new file
+ H5fid2 = H5.H5Fcreate("copy.h5", HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ assertTrue("testH5OcopyRefsDatasettodiffFile.H5Fcreate: ", H5fid2 >= 0);
+ H5.H5Fflush(H5fid2, HDF5Constants.H5F_SCOPE_LOCAL);
+ }
+ catch (Exception ex) {
+ try {H5.H5Fclose(H5fid2);} catch (Exception exx) {}
+ fail("testH5OcopyRefsDatasettodiffFile: H5Fcreate failed");
+ }
+
+ try {
+ //create object copy property list id and set the flags.
+ ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY);
+ assertTrue("testH5OcopyRefsDatasettodiffFile.H5Pcreate: ", ocp_plist_id >= 0);
+ H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG);
+
+ //Perform copy function.
+ H5.H5Ocopy(H5fid, ".", H5fid2, "CPYREFD", ocp_plist_id, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Exception ex){
+ ex.printStackTrace();
+ fail("testH5OcopyRefsDatasettodiffFile: H5Ocopy failed");
+ }
+ finally {
+ try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {}
+ try {H5.H5Fclose(H5fid2);} catch (Exception ex) {}
+ }
+ _deleteFile("copy.h5");
+ }
+
+ @Test
+ public void testH5OcopyRefsDatasettosameFile() {
+ byte rbuf0[]=null , rbuf1[] = null;
+ byte[] dset_data = new byte[16];
+ long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long did = HDF5Constants.H5I_INVALID_HID;
+ int obj_type = -1;
+ byte[] read_data = new byte[16];
+
+ try {
+ rbuf0 = H5.H5Rcreate(H5fid, "/G1", HDF5Constants.H5R_OBJECT, -1);
+ rbuf1 = H5.H5Rcreate(H5fid, "DS2", HDF5Constants.H5R_OBJECT, -1);
+ System.arraycopy(rbuf0, 0, dset_data, 0, 8);
+ System.arraycopy(rbuf1, 0, dset_data, 8, 8);
+
+ //Create a dataset and write object references to it.
+ dataset_id = H5.H5Dcreate(H5fid, "DSREF",
+ HDF5Constants.H5T_STD_REF_OBJ, H5dsid,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ assertTrue("testH5OcopyRefsDatasettosameFile.H5Dcreate: ", dataset_id >= 0);
+ H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF_OBJ,
+ HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data);
+ //Close the dataset.
+ H5.H5Dclose(dataset_id);
+ }
+ catch (Exception ex) {
+ try {H5.H5Dclose(dataset_id);} catch (Exception exx) {}
+ fail("testH5OcopyRefsDatasettosameFile: create dataset failed");
+ }
+
+ try {
+ ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY);
+ assertTrue("testH5OcopyRefsDatasettosameFile.H5Pcreate: ", ocp_plist_id >= 0);
+ H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG);
+ }
+ catch (Exception ex) {
+ try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {}
+ fail("testH5OcopyRefsDatasettosameFile: H5Pset_copy_object failed");
+ }
+
+ //Perform copy function.
+ try {
+ H5.H5Ocopy(H5fid, "DSREF", H5fid, "CPYREFD", ocp_plist_id, HDF5Constants.H5P_DEFAULT);
+ }
+ catch(Exception ex) {
+ try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {}
+ fail("testH5OcopyRefsDatasettosameFile: H5Ocopy failed");
+ }
+
+ //Open the dataset that has been copied
+ try {
+ did = H5.H5Dopen(H5fid, "DSREF", HDF5Constants.H5P_DEFAULT);
+ assertTrue("testH5OcopyRefsDatasettosameFile.H5Dopen: ", did >= 0);
+ }
+ catch (Exception e) {
+ try {H5.H5Dclose(did);} catch (Exception exx) {}
+ e.printStackTrace();
+ fail("testH5OcopyRefsDatasettosameFile: H5Dopen failed");
+ }
+
+ try {
+ //Read the dataset object references in the read_data buffer.
+ H5.H5Dread(did, HDF5Constants.H5T_STD_REF_OBJ, HDF5Constants.H5S_ALL,HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, read_data);
+ System.arraycopy(read_data, 0, rbuf0, 0, 8);
+ System.arraycopy(read_data, 8, rbuf1, 0, 8);
+
+ //Get the type of object the reference points to.
+ obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, rbuf1);
+ assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET);
+
+ obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, rbuf0);
+ assertEquals(obj_type, HDF5Constants.H5O_TYPE_GROUP);
+ }
+ catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ finally {
+ try {H5.H5Dclose(did);} catch (Exception ex) {}
+ try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {}
+ }
+ }
+
+ @Test
+ public void testH5OcopyNullRef() throws Throwable {
+ final long _pid_ = HDF5Constants.H5P_DEFAULT;
+ long sid = HDF5Constants.H5I_INVALID_HID;
+ long did = HDF5Constants.H5I_INVALID_HID;
+ long aid = HDF5Constants.H5I_INVALID_HID;
+
+ try {
+ sid = H5.H5Screate_simple(1, new long[] {1}, null);
+ assertTrue("testH5OcopyNullRef.H5Screate_simple: ", sid >= 0);
+ did = H5.H5Dcreate(H5fid, "Dataset_with_null_Ref", HDF5Constants.H5T_NATIVE_INT, sid, _pid_, _pid_, _pid_);
+ assertTrue("testH5OcopyNullRef.H5Dcreate: ", did > 0);
+ aid = H5.H5Acreate(did, "Null_Ref", HDF5Constants.H5T_STD_REF_OBJ, sid, _pid_, _pid_);
+ assertTrue("testH5OcopyNullRef.H5Acreate: ", aid > 0);
+ }
+ catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ finally {
+ try {H5.H5Dclose(did);} catch (Exception exx) {}
+ try {H5.H5Aclose(aid);} catch (Exception exx) {}
+ try {H5.H5Sclose(sid);} catch (Exception exx) {}
+ }
+
+ long ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY);
+ assertTrue("testH5OcopyNullRef.H5Pcreate: ", ocp_plist_id >= 0);
+ H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG);
+ try {
+ H5.H5Ocopy(H5fid, "/Dataset_with_null_Ref", H5fid, "/Dataset_with_null_Ref_cp", ocp_plist_id, _pid_);
+ }
+ finally {
+ try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {}
+ }
+ }
+
+// @Ignore because of JIRA HDF5-9547
+// @Test(expected = HDF5LibraryException.class)
+// public void testH5OcopyInvalidRef() throws Throwable {
+// final long _pid_ = HDF5Constants.H5P_DEFAULT;
+// long sid = HDF5Constants.H5I_INVALID_HID;
+// long did = HDF5Constants.H5I_INVALID_HID;
+// long aid = HDF5Constants.H5I_INVALID_HID;
+//
+// try {
+// sid = H5.H5Screate_simple(1, new long[] {1}, null);
+// assertTrue("testH5OcopyInvalidRef.H5Screate_simple: ", sid >= 0);
+// did = H5.H5Dcreate(H5fid, "Dataset_with_invalid_Ref", HDF5Constants.H5T_NATIVE_INT, sid, _pid_, _pid_, _pid_);
+// assertTrue("testH5OcopyInvalidRef.H5Dcreate: ", did > 0);
+// aid = H5.H5Acreate(did, "Invalid_Ref", HDF5Constants.H5T_STD_REF_OBJ, sid, _pid_, _pid_);
+// assertTrue("testH5OcopyInvalidRef.H5Acreate: ", aid > 0);
+// H5.H5Awrite(aid, HDF5Constants.H5T_STD_REF_OBJ, new long[]{-1});
+// }
+// catch (Exception ex) {
+// ex.printStackTrace();
+// }
+// finally {
+// try {H5.H5Dclose(did);} catch (Exception exx) {}
+// try {H5.H5Aclose(aid);} catch (Exception exx) {}
+// try {H5.H5Sclose(sid);} catch (Exception exx) {}
+// }
+//
+// long ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY);
+// assertTrue("testH5OcopyInvalidRef.H5Pcreate: ", ocp_plist_id >= 0);
+// H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG);
+// try {
+// H5.H5Ocopy(H5fid, "/Dataset_with_invalid_Ref", H5fid, "/Dataset_with_invalid_Ref_cp", ocp_plist_id, _pid_);
+// }
+// finally {
+// try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {}
+// }
+// }
+
+}
diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java
index 3879128..6ae93d9 100644
--- a/java/test/TestH5P.java
+++ b/java/test/TestH5P.java
@@ -1173,12 +1173,12 @@ public class TestH5P {
strategy = H5.H5Pget_file_space_strategy(fcpl_id, persist, threshold);
assertTrue("strategy(default): "+strategy, strategy == HDF5Constants.H5F_FSPACE_STRATEGY_FSM_AGGR);
assertTrue("persist(default): "+persist[0], persist[0] == false);
- assertTrue("theshold(default): "+threshold[0], threshold[0] == 1);
+ assertTrue("threshold(default): "+threshold[0], threshold[0] == 1);
H5.H5Pset_file_space_strategy(fcpl_id, HDF5Constants.H5F_FSPACE_STRATEGY_PAGE, true, 1);
strategy = H5.H5Pget_file_space_strategy(fcpl_id, persist, threshold);
assertTrue("strategy: "+strategy, strategy == HDF5Constants.H5F_FSPACE_STRATEGY_PAGE);
assertTrue("persist: "+persist[0], persist[0] == true);
- assertTrue("theshold: "+threshold[0], threshold[0] == 1);
+ assertTrue("threshold: "+threshold[0], threshold[0] == 1);
}
catch (Throwable err) {
err.printStackTrace();
diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java
index a65b52e..f6be24f 100644
--- a/java/test/TestH5Pfapl.java
+++ b/java/test/TestH5Pfapl.java
@@ -892,7 +892,7 @@ public class TestH5Pfapl {
try {
H5.H5Pset_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr, true);
long driver_type = H5.H5Pget_driver(fapl_id);
- assertTrue("H5Pget_driver: muti = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type);
+ assertTrue("H5Pget_driver: multi = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type);
}
catch (Throwable err) {
err.printStackTrace();
@@ -932,7 +932,7 @@ public class TestH5Pfapl {
try {
H5.H5Pset_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr, true);
long driver_type = H5.H5Pget_driver(fapl_id);
- assertTrue("H5Pget_driver: muti = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type);
+ assertTrue("H5Pget_driver: multi = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type);
}
catch (Throwable err) {
err.printStackTrace();
@@ -1001,7 +1001,7 @@ public class TestH5Pfapl {
try {
H5.H5Pset_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr, true);
long driver_type = H5.H5Pget_driver(fapl_id);
- assertTrue("H5Pget_driver: muti = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type);
+ assertTrue("H5Pget_driver: multi = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type);
}
catch (Throwable err) {
err.printStackTrace();
@@ -1223,7 +1223,7 @@ public class TestH5Pfapl {
try {
H5.H5Pset_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr, true);
long driver_type = H5.H5Pget_driver(fapl_id);
- assertTrue("H5Pget_driver: muti = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type);
+ assertTrue("H5Pget_driver: multi = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type);
}
catch (Throwable err) {
err.printStackTrace();
diff --git a/java/test/TestH5Plist.java b/java/test/TestH5Plist.java
index 0d53071..03e1c8f 100644
--- a/java/test/TestH5Plist.java
+++ b/java/test/TestH5Plist.java
@@ -148,7 +148,7 @@ public class TestH5Plist {
}
assertTrue("H5Pequal cid2", status >= 0);
- // Make certain false postives aren't being returned
+ // Make certain false positives aren't being returned
try {
status = H5.H5Pequal(cid2, HDF5Constants.H5P_FILE_CREATE);
}
@@ -295,7 +295,7 @@ public class TestH5Plist {
}
assertTrue("H5Pget_nprops: "+nprops, nprops==0);
- // Check the existance of the first property (should fail)
+ // Check the existence of the first property (should fail)
try {
status = H5.H5Pexist(plist_class_id, PROP1_NAME);
}
@@ -326,7 +326,7 @@ public class TestH5Plist {
catch (Throwable err) {
}
- // Check the existance of the first property
+ // Check the existence of the first property
try {
status = H5.H5Pexist(plist_class_id, PROP1_NAME);
}
@@ -377,7 +377,7 @@ public class TestH5Plist {
catch (Throwable err) {
}
- // Check the existance of the second property
+ // Check the existence of the second property
try {
status = H5.H5Pexist(plist_class_id, PROP2_NAME);
}
@@ -418,7 +418,7 @@ public class TestH5Plist {
fail("H5Pregister2 plist_class_id: "+PROP3_NAME + err);
}
- // Check the existance of the third property
+ // Check the existence of the third property
try {
status = H5.H5Pexist(plist_class_id, PROP3_NAME);
}
diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in
index 39db296..ca2b3a9 100644
--- a/java/test/junit.sh.in
+++ b/java/test/junit.sh.in
@@ -66,8 +66,8 @@ $top_builddir/java/src/jni/.libs/libhdf5_java.*
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
+$HDFLIB_HOME/slf4j-api-1.7.33.jar
+$HDFLIB_HOME/ext/slf4j-simple-1.7.33.jar
"
LIST_JAR_FILES="
$top_builddir/java/src/$JARFILE
@@ -108,6 +108,7 @@ $HDFTEST_HOME/testfiles/JUnit-TestH5Arw.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Oparams.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Obasic.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Ocreate.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5OcopyOld.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Ocopy.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5PL.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5VL.txt
@@ -298,7 +299,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@
COPY_LIBFILES_TO_BLDLIBDIR
COPY_DATAFILES_TO_BLDDIR
-CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/junit.jar:"$BLDLIBDIR"/hamcrest-core.jar:"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE""
+CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/junit.jar:"$BLDLIBDIR"/hamcrest-core.jar:"$BLDLIBDIR"/slf4j-api-1.7.33.jar:"$BLDLIBDIR"/slf4j-simple-1.7.33.jar:"$TESTJARFILE""
TEST=/usr/bin/test
if [ ! -x /usr/bin/test ]
@@ -1030,6 +1031,27 @@ else
test yes = "$verbose" && $DIFF JUnit-TestH5Ocreate.txt JUnit-TestH5Ocreate.out |sed 's/^/ /'
fi
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5OcopyOld"
+TESTING JUnit-TestH5OcopyOld
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5OcopyOld > JUnit-TestH5OcopyOld.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5OcopyOld.ext > JUnit-TestH5OcopyOld.out
+
+if diff JUnit-TestH5OcopyOld.out JUnit-TestH5OcopyOld.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5OcopyOld"
+else
+ echo "**FAILED** JUnit-TestH5OcopyOld"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5OcopyOld.txt JUnit-TestH5OcopyOld.out |sed 's/^/ /'
+fi
+
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocopy"
TESTING JUnit-TestH5Ocopy
($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocopy > JUnit-TestH5Ocopy.ext)
diff --git a/java/test/testfiles/JUnit-TestH5Ocopy.txt b/java/test/testfiles/JUnit-TestH5Ocopy.txt
index 32dfde7..7f66410 100644
--- a/java/test/testfiles/JUnit-TestH5Ocopy.txt
+++ b/java/test/testfiles/JUnit-TestH5Ocopy.txt
@@ -1,9 +1,10 @@
JUnit version 4.11
.testH5OcopyRefsDatasettosameFile
+.testH5OcopyNullRef
.testH5OcopyRefsDatasettodiffFile
.testH5OcopyRefsAttr
Time: XXXX
-OK (3 tests)
+OK (4 tests)
diff --git a/java/test/testfiles/JUnit-TestH5OcopyOld.txt b/java/test/testfiles/JUnit-TestH5OcopyOld.txt
new file mode 100644
index 0000000..7f66410
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5OcopyOld.txt
@@ -0,0 +1,10 @@
+JUnit version 4.11
+.testH5OcopyRefsDatasettosameFile
+.testH5OcopyNullRef
+.testH5OcopyRefsDatasettodiffFile
+.testH5OcopyRefsAttr
+
+Time: XXXX
+
+OK (4 tests)
+