Skip to content
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

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

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 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.

Loading

@openjdk openjdk bot added the rfr label Sep 8, 2020
@openjdk
Copy link

@openjdk 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.

Loading

@openjdk openjdk bot added 2d awt labels Sep 8, 2020
@mlbridge
Copy link

@mlbridge mlbridge bot commented Sep 8, 2020

Webrevs

Loading

Copy link
Contributor

@prrace prrace left a comment

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 ?

Loading

@mrserb
Copy link
Member Author

@mrserb 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

Loading

prrace
prrace approved these changes Sep 9, 2020
Copy link
Contributor

@prrace prrace left a comment

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

Loading

@openjdk
Copy link

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

  • ff21696: 8252817: Cleanup the classes in the java.awt.color package
  • 44a74da: 8252919: JDK built with --enable-cds=no fails with NoClassDefFoundError
  • 418e4a2: 8252830: Correct missing javadoc comments in java.rmi module
  • 41d29b7: 8252774: remove jdk.test.lib.FileInstaller action from graalunit tests
  • 5b30a83: 8252778: remove jdk.test.lib.FileInstaller action from compiler/c2/stemmer test
  • 8db3335: 8247928: Refactor G1ConcurrentMarkThread for mark abort
  • 7ccf435: 8252846: Fix ppc/s390 after "8231441: AArch64: Initial SVE backend su…
  • d236cf4: 8252995: Non-PCH builds broken by JDK-8250961
  • 6a00534: 8250961: Move Universe::update_heap_info_at_gc to CollectedHeap
  • f78f780: 8252889: Obsolete -XX:+InsertMemBarAfterArraycopy
  • ... and 11 more: https://git.openjdk.java.net/jdk/compare/e20004d7c170dc9f25f23c0a5dbf3a4c67db9423...master

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.

Loading

@openjdk openjdk bot added the ready label Sep 9, 2020
@mrserb
Copy link
Member Author

@mrserb mrserb commented Sep 10, 2020

/integrate

Loading

@openjdk openjdk bot closed this Sep 10, 2020
@openjdk openjdk bot added integrated and removed ready rfr labels Sep 10, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Sep 10, 2020

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

  • ff21696: 8252817: Cleanup the classes in the java.awt.color package
  • 44a74da: 8252919: JDK built with --enable-cds=no fails with NoClassDefFoundError
  • 418e4a2: 8252830: Correct missing javadoc comments in java.rmi module
  • 41d29b7: 8252774: remove jdk.test.lib.FileInstaller action from graalunit tests
  • 5b30a83: 8252778: remove jdk.test.lib.FileInstaller action from compiler/c2/stemmer test
  • 8db3335: 8247928: Refactor G1ConcurrentMarkThread for mark abort
  • 7ccf435: 8252846: Fix ppc/s390 after "8231441: AArch64: Initial SVE backend su…
  • d236cf4: 8252995: Non-PCH builds broken by JDK-8250961
  • 6a00534: 8250961: Move Universe::update_heap_info_at_gc to CollectedHeap
  • f78f780: 8252889: Obsolete -XX:+InsertMemBarAfterArraycopy
  • ... and 11 more: https://git.openjdk.java.net/jdk/compare/e20004d7c170dc9f25f23c0a5dbf3a4c67db9423...master

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.

Loading

@mrserb mrserb deleted the JDK-7183828 branch Sep 10, 2020
@mrserb mrserb restored the JDK-7183828 branch Sep 10, 2020
@mrserb mrserb deleted the JDK-7183828 branch Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants