Skip to content

Minor correction to H5Tget_super failure checks in JNI helpers - #6599

Open
mattjala wants to merge 1 commit into
HDFGroup:developfrom
mattjala:jni_type_error_checks
Open

Minor correction to H5Tget_super failure checks in JNI helpers#6599
mattjala wants to merge 1 commit into
HDFGroup:developfrom
mattjala:jni_type_error_checks

Conversation

@mattjala

@mattjala mattjala commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

The base type lookups in the object-tree helpers tested the returned hid_t for truth rather than for a negative value. A failed lookup returns H5I_INVALID_HID, so any failure wouldn't be caught until later.

Rework the checks to use the more standard < 0 comparison for ID-related failures.

The base type lookups in the object-tree helpers tested the
returned hid_t for truth rather than for a negative value. A failed
lookup returns H5I_INVALID_HID (-1), resolving true when checked, so any
failure wouldn't be caught until later.
@mattjala mattjala added this to the HDF5 2.x.x milestone Aug 7, 2026
@mattjala
mattjala requested a review from jhendersonHDF as a code owner August 7, 2026 16:20
@mattjala mattjala added the Component - Wrappers C++, Java & Fortran wrappers label Aug 7, 2026
Copilot AI lite review requested due to automatic review settings August 7, 2026 16:20
@github-project-automation github-project-automation Bot moved this to To be triaged in HDF5 - TRIAGE & TRACK Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Checklist

This PR touches the following areas. Each needs a sign-off
from its listed owners before merging.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes incorrect error handling in the Java JNI datatype translation helpers by ensuring failures from H5Tget_super() are detected immediately (using the standard negative-hid_t check), preventing invalid IDs from propagating and failing later.

Changes:

  • Replace !(hid_t)-style truthiness checks on H5Tget_super() results with explicit < 0 failure checks in multiple translation/validation paths.
  • Align H5Tget_super() error handling with existing hid_t-returning API conventions used elsewhere in the JNI code.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component - Wrappers C++, Java & Fortran wrappers

Projects

Status: To be triaged

Development

Successfully merging this pull request may close these issues.

2 participants