Skip to content

Conversation

@jayathirthrao
Copy link
Member

@jayathirthrao jayathirthrao commented Nov 4, 2025

java.awt.image.Kernel constructor doesn't validate all input values and we need to add appropriate checks.
A new test is also added to make sure we appropriate exception when invalid values are passed.

This will also need a CSR.


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
  • Change requires CSR request JDK-8371308 to be approved

Issues

  • JDK-8368729: Add appropriate checks in java.awt.image.Kernel constructor (Bug - P3)
  • JDK-8371308: Add appropriate checks in java.awt.image.Kernel constructor (CSR)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 28127

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 4, 2025

👋 Welcome back jdv! 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.

@openjdk
Copy link

openjdk bot commented Nov 4, 2025

@jayathirthrao 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:

8368729: Add appropriate checks in java.awt.image.Kernel constructor

Reviewed-by: azvegint, prr, kizune

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 46 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 client client-libs-dev@openjdk.org label Nov 4, 2025
@openjdk
Copy link

openjdk bot commented Nov 4, 2025

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

  • client

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 Nov 4, 2025
@mlbridge
Copy link

mlbridge bot commented Nov 4, 2025

Webrevs

@azuev-java
Copy link
Member

The change seems reasonable but as you mentioned we will need CSR for changing public constructor documentation and it needs to be linked here.

Copy link
Member

@azvegint azvegint left a comment

Choose a reason for hiding this comment

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

/csr needed

@openjdk openjdk bot added ready Pull request is ready to be integrated csr Pull request needs approved CSR before integration labels Nov 4, 2025
@openjdk
Copy link

openjdk bot commented Nov 4, 2025

@azvegint has indicated that a compatibility and specification (CSR) request is needed for this pull request.

@jayathirthrao please create a CSR request for issue JDK-8368729 with the correct fix version. This pull request cannot be integrated until the CSR request is approved.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Nov 4, 2025
@jayathirthrao
Copy link
Member Author

The change seems reasonable but as you mentioned we will need CSR for changing public constructor documentation and it needs to be linked here.

Thanks for the review. There were some issues with Jira yesterday, so didn't raise a CSR.
CSR is added now.

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed csr Pull request needs approved CSR before integration labels Nov 5, 2025
* @param width width of the kernel
* @param height height of the kernel
* @param data kernel data in row major order
* @throws IllegalArgumentException if {@code data} is null
Copy link
Member

Choose a reason for hiding this comment

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

Is there any particular reason why IllegalArgumentException was chosen instead of NullPointerException?

Copy link
Member Author

@jayathirthrao jayathirthrao Nov 6, 2025

Choose a reason for hiding this comment

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

Spec of NPE states multiple reasons of when an NPE is thrown while using null object and IAE clearly mentions that we are trying to validate input arguments and throw it when we see any issue.

Current spec already throws IAE in one of the validation scenario, so throwing the same IAE for other input argument validation is uniform.

We can say that in some parts of JDK we throw NPE for null argument verification, but using IAE in this scenario looks better.

Copy link
Member

Choose a reason for hiding this comment

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

Current spec already throws IAE in one of the validation scenario, so throwing the same IAE for other input argument validation is uniform.

We usually throw an NPE when the value is null, since you can’t validate any properties on a null reference, and it’s more specific than an IAE. Moreover, NPE was thrown before, so this won’t change the behavior.

Copy link
Member Author

Choose a reason for hiding this comment

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

NPE which was thrown before was undefined behaviour.
There is no objection in CSR request also. I would like to continue keeping usage of IAE.

If majority of reviewers have objections, we can take it up in follow-up issue.

Copy link
Member

Choose a reason for hiding this comment

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

NPE which was thrown before was undefined behaviour.
There is no objection in CSR request also. I would like to continue keeping usage of IAE.

Most of the new code in the JDK throws NullPointerException for null arguments. We already had a similar discussion recently, and most of the same arguments apply here as well:
https://mail.openjdk.org/pipermail/client-libs-dev/2025-May/028879.html
040e8dd

It also appears that this is the first usage of "@throws IllegalArgumentException" for null parameters in that package, but there are some usages of NPE for null.

If majority of reviewers have objections, we can take it up in follow-up issue.

I have filed: https://bugs.openjdk.org/browse/JDK-8371501

@jayathirthrao
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Nov 7, 2025

Going to push as commit 4233178.
Since your change was applied there have been 75 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Nov 7, 2025
@openjdk openjdk bot closed this Nov 7, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 7, 2025
@openjdk
Copy link

openjdk bot commented Nov 7, 2025

@jayathirthrao Pushed as commit 4233178.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

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

Labels

client client-libs-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

5 participants