-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8368729: Add appropriate checks in java.awt.image.Kernel constructor #28127
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
Conversation
|
👋 Welcome back jdv! A progress list of the required criteria for merging this PR into |
|
@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: 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
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 |
|
@jayathirthrao The following label will be automatically applied to this pull request:
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. |
|
The change seems reasonable but as you mentioned we will need CSR for changing public constructor documentation and it needs to be linked here. |
azvegint
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/csr needed
|
@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. |
Thanks for the review. There were some issues with Jira yesterday, so didn't raise a CSR. |
| * @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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
|
/integrate |
|
Going to push as commit 4233178.
Your commit was automatically rebased without conflicts. |
|
@jayathirthrao Pushed as commit 4233178. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
java.awt.image.Kernelconstructor 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
Issues
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28127/head:pull/28127$ git checkout pull/28127Update a local copy of the PR:
$ git checkout pull/28127$ git pull https://git.openjdk.org/jdk.git pull/28127/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28127View PR using the GUI difftool:
$ git pr show -t 28127Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28127.diff
Using Webrev
Link to Webrev Comment