Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update open/close of object reader #566

Merged
merged 1 commit into from
Dec 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public void validate(ArrayObject arrayObject) {
LOG.debug("validate:tableNameReportStr {}", tableNameReportStr);

try {
arrayObject.open();
process(array, arrayObject, dimensions, new int[dimensions.length], 0, dimensions.length - 1);

} catch (Exception e) {
Expand All @@ -141,7 +142,6 @@ private void process(Array array, ArrayObject arrayObject, int[] dimensions, int
System.out.print(".");
}

arrayObject.open();
for (int i = 0; i < dimensions[depth];) {
if (depth < maxDepth) { // max depth not reached, do another recursion
position[depth] = i;
Expand All @@ -162,7 +162,6 @@ private void process(Array array, ArrayObject arrayObject, int[] dimensions, int
}
}
}
arrayObject.close();
}

private void validatePosition(Array array, ArrayObject arrayObject, ArrayLocation location,
Expand Down Expand Up @@ -260,10 +259,11 @@ private void validatePosition(Array array, ArrayObject arrayObject, ArrayLocatio
loc = loc.replaceAll("\\]", "");
}

// #544: @jpl-jengelke reports that validate used to produce a detailed error message but now just
// says `null`. @jordanpadams says the calculation is no longer completed by the software and didn't
// make sense, but that said, `null` is not intuitive.
String message = "Error occurred while trying to " + "read data at location " + loc + ". Verify possible mismatch in file size and expected array size.";
// #544: @jpl-jengelke reports that validate used to produce a detailed error message but now
// just says `null`. @jordanpadams says the calculation is no longer completed by the software
// and didn't make sense, but that said, `null` is not intuitive.
String message = "Error occurred while trying to " + "read data at location " + loc
+ ". Verify possible mismatch in data type and/or file size versus array size.";
if (ee.getMessage() != null)
message += ": " + ee.getMessage();
throw new IOException(message);
Expand Down