Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
8326712: Robot tests fail on XWayland #1490
8326712: Robot tests fail on XWayland #1490
Changes from 6 commits
340adcc
96f5023
30b0c2a
d83d454
e267212
880a833
b2fdc5a
9f4bea6
76a4f3c
4a9578c
fdb1249
8cb392c
468c2ba
04dd233
ea7448d
3aa56a2
8ab6ff2
33fa538
2b05125
2c5d425
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
@kevinrushforth
I think this SecurityException should be removed, as it is not mentioned in the javadoc for the
getPixelColor
orgetScreenCapture
. And we also do not want to throw another runtime exception.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.
If the SecurityException is not thrown, how does the caller of
getRGBPixels
knows that the result will not be correct because of the missing permission? (as opposed to being incorrect due to a failure)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.
He won't know it. An indirect result of failure can be a black image.
The current documentation documentation specifies only IllegalStateException and 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.
Since
SecurityException
is deprecated, we should not throw that.In a similar situation on macOS (user has not enabled screen capture), we return a blank (all black) image, so I think that's what we would do here.
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.
Updated to return a blank image if permission is not granted.
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.
No, SecurityException is NOT deprecated and there are no plans to deprecate it.
https://download.java.net/java/early_access/jdk23/docs/api/java.base/java/lang/SecurityException.html#%3Cinit%3E()
This kind of platform reason for a "SecurityException" is precisely why it isn't deprecated even though the Java SecurityManager is deprecated.
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.
Thanks for the correction about "SecurityException" not being deprecated.
I still think that for this PR, we should not throw an exception, since we A) don't specify it to do so, and B) don't do that on macOS in a nearly identical situation.
We could consider a future RFE to change the spec (and maybe the behavior).