Skip to content

7183828: Invalid Image Variant when using anything other than BufferedImage #85

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

Closed
wants to merge 1 commit into from

Conversation

mrserb
Copy link
Member

@mrserb mrserb commented Sep 8, 2020

It is intended that our draw machinery works only on specific image formats that we know we support.
But the user still able to create some image subclasses for their purpose and according to our spec of
Graphics2D.drawImage() we should not throw any exceptions.

I suggest handling this situation in a similar way as we handle some errors during rendering when
the pipeline is in the wrong state, or the ToolkitImage is not loaded yet, just ignore the request and
return false.

All our pipelines have a special meaning of InvalidPipeException, if the pipeline found that it cannot complete the draw
operation throws this exception which is handled by all methods in the SunGraphics2D class.

So as a fix I suggest changing the IllegalArgumentException to the InvalidPipeException.
Also, we need to add a try/catch block to the drawHiDPIImage(it uses the SurfaceManager.getManager method directly)

Old review request:
https://mail.openjdk.java.net/pipermail/2d-dev/2020-August/010995.html


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-7183828: Invalid Image Variant when using anything other than BufferedImage

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/85/head:pull/85
$ git checkout pull/85

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 8, 2020

👋 Welcome back serb! 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 openjdk bot added the rfr Pull request is ready for review label Sep 8, 2020
@openjdk
Copy link

openjdk bot commented Sep 8, 2020

@mrserb The following labels will be automatically applied to this pull request: 2d awt.

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

@openjdk openjdk bot added 2d client-libs-dev@openjdk.org awt client-libs-dev@openjdk.org labels Sep 8, 2020
@mlbridge
Copy link

mlbridge bot commented Sep 8, 2020

Webrevs

Copy link
Contributor

@prrace prrace left a comment

Choose a reason for hiding this comment

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

I have very mixed feelings about this whole idea.
InvalidPipeException is being co-opted for a different purpose.
The user no longer gets a clear message that their image type isn't supported.
Is there any specification we can point to ?

@mrserb
Copy link
Member Author

mrserb commented Sep 9, 2020

I have very mixed feelings about this whole idea.
InvalidPipeException is being co-opted for a different purpose.

We already use this exception in such cases, and I think it is intended for this:
https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/sun/java2d/opengl/OGLMaskFill.java#L75
https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/sun/java2d/NullSurfaceData.java#L92

The user no longer gets a clear message that their image type isn't supported.
Is there any specification we can point to ?

The spec for the Image class:

Or the spec for the VolatileImage

Copy link
Contributor

@prrace prrace left a comment

Choose a reason for hiding this comment

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

Ok. Fair enough. Please copy those spec. excerpts into the bug report.

@openjdk
Copy link

openjdk bot commented Sep 9, 2020

@mrserb This change now passes all automated pre-integration checks. In addition to the automated checks, the change must also fulfill all project specific requirements

After integration, the commit message will be:

7183828: Invalid Image Variant when using anything other than BufferedImage

Reviewed-by: prr
  • If you would like to add a summary, use the /summary command.
  • To credit additional contributors, use the /contributor command.
  • To add additional solved issues, use the /issue command.

Since the source branch of this PR was last updated there have been 21 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 automatic rebasing, please merge master into your branch, and then specify the current head hash when integrating, like this: /integrate ff21696bc00d447bda61df826f1ff2d2ab2cf969.

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

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 9, 2020
@mrserb
Copy link
Member Author

mrserb commented Sep 10, 2020

/integrate

@openjdk openjdk bot closed this Sep 10, 2020
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Sep 10, 2020
@openjdk
Copy link

openjdk bot commented Sep 10, 2020

@mrserb Since your change was applied there have been 21 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

Pushed as commit 8da6c8d.

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

@mrserb mrserb deleted the JDK-7183828 branch September 10, 2020 21:26
@mrserb mrserb restored the JDK-7183828 branch September 10, 2020 21:27
@mrserb mrserb deleted the JDK-7183828 branch September 10, 2020 21:28
oraluben pushed a commit to oraluben/jdk that referenced this pull request Feb 15, 2022
8252388: Allocation without ResourceMark in InterpreterOopMap::resource_copy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2d client-libs-dev@openjdk.org awt client-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

2 participants