Skip to content

8377910: Minor cleanup of java/io/FileDescriptor/Sharing.java#29718

Open
bplb wants to merge 3 commits intoopenjdk:masterfrom
bplb:FileDescriptor-Sharing-8137073
Open

8377910: Minor cleanup of java/io/FileDescriptor/Sharing.java#29718
bplb wants to merge 3 commits intoopenjdk:masterfrom
bplb:FileDescriptor-Sharing-8137073

Conversation

@bplb
Copy link
Member

@bplb bplb commented Feb 13, 2026

Null checks potentially mask a more serious, fundamental problem and should be removed to allow a NullPointerException to be throw if the variable is null.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8377910: Minor cleanup of java/io/FileDescriptor/Sharing.java (Sub-task - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/29718/head:pull/29718
$ git checkout pull/29718

Update a local copy of the PR:
$ git checkout pull/29718
$ git pull https://git.openjdk.org/jdk.git pull/29718/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 29718

View PR using the GUI difftool:
$ git pr show -t 29718

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/29718.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 13, 2026

👋 Welcome back bpb! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@bplb
Copy link
Member Author

bplb commented Feb 13, 2026

It appears that the null checks in question were intended to match others elsewhere in the test where the checks are in a finally block and there are multiple variables among which not all might be null depending on which variables were initialized in the try block.

@openjdk
Copy link

openjdk bot commented Feb 13, 2026

@bplb This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8377910: Minor cleanup of java/io/FileDescriptor/Sharing.java

Reviewed-by: alanb

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 13 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Feb 13, 2026
@openjdk
Copy link

openjdk bot commented Feb 13, 2026

@bplb The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 13, 2026
@mlbridge
Copy link

mlbridge bot commented Feb 13, 2026

Webrevs

if(fisArray[i] != null) fisArray[i].close();
if(fosArray[i] != null) fosArray[i].close();
fisArray[i].close();
fosArray[i].close();
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be clearer if you change fisArray and fosArray to be local to the run method. There is no reason for them to be fields in OpenClose. Making fd and done final would help too.

I can't see from the bug report what failed but hopefully better output with the changes.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can't see from the bug report what failed but hopefully better output with the changes.

It's not clear exactly what failed (in the parent task issue) but perhaps this will disambiguate the situation a bit.

Copy link
Member Author

Choose a reason for hiding this comment

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

It might be clearer if you change fisArray and fosArray to be local to the run method. There is no reason for them to be fields in OpenClose. Making fd and done final would help too.

Done in 9dd1613.

Note that this code has bad indentation but I am leaving that alone until the end.

Copy link
Member Author

Choose a reason for hiding this comment

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

Note that this code has bad indentation but I am leaving that alone until the end.

Indentation fixed in 73d9eab.

if (fd.valid()) { // fd should not be valid after first close() call
System.out.println("OpenClose: FileDescriptor shouldn't be valid");
System.err.println("OpenClose: FileDescriptor shouldn't be valid");
fail = true;
Copy link
Member Author

Choose a reason for hiding this comment

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

The failure reported in the parent issue occurs because fd.valid() is true at line 378. Code inspection alone does not reveal any reason for it.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 13, 2026
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Feb 13, 2026
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-libs core-libs-dev@openjdk.org ready Pull request is ready to be integrated rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants