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

8245456: MacPasteboard throws ClassCastException on static builds #228

Closed
wants to merge 1 commit into from

Conversation

jperedadnr
Copy link
Collaborator

@jperedadnr jperedadnr commented May 20, 2020

Trying to paste on a JavaFX app statically built on Mac OS throws:

Exception in thread "JavaFX Application Thread" java.lang.ClassCastException 
        at         at com.sun.glass.ui.mac.MacPasteboard._getUTFs(MacPasteboard.java) 

Checking the native method signature a String[][] type is expected. However the native method implementation uses:

jobjectArray utfs = (*env)->NewObjectArray(env, size, (*env)->FindClass(env, "java/lang/Object"), NULL);
for (items) {
     jobjectArray array = (*env)->NewObjectArray(env, size, (*env)->FindClass(env, "java/lang/String"), NULL);
}

This PR fixes the issue by applying the correct array type signature according to JNI specs.

It has been tested on Mac OS, both with and without static build.


Progress

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

Issue

  • JDK-8245456: MacPasteboard throws ClassCastException on static builds

Reviewers

  • Kevin Rushforth (kcr - Reviewer)

Download

$ git fetch https://git.openjdk.java.net/jfx pull/228/head:pull/228
$ git checkout pull/228

@bridgekeeper
Copy link

bridgekeeper bot commented May 20, 2020

👋 Welcome back jpereda! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request.

@openjdk openjdk bot added the rfr Ready for review label May 20, 2020
@mlbridge
Copy link

mlbridge bot commented May 20, 2020

Webrevs

@kevinrushforth
Copy link
Member

So this is a case where native image exposed a latent bug in FX. Would this have been caught by -Xcheck:jni? (I hope it would have). We aren't in the habit of regularly running tests with that option, but maybe we should do it more often.

@openjdk
Copy link

openjdk bot commented May 20, 2020

@jperedadnr This change now passes all automated pre-integration checks. When the change also fulfills all project specific requirements, type /integrate in a new comment to proceed. After integration, the commit message will be:

8245456: MacPasteboard throws ClassCastException on static builds

Reviewed-by: kcr
  • 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.

There are currently no new commits on the master branch since the last update of the source branch of this PR. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you would like to avoid potential automatic rebasing, specify the current head hash when integrating, like this: /integrate 6e039302675fcbff34beb8cf419952e83cb5fd19.

As you do not have Committer status in this project, an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@kevinrushforth) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Ready to be integrated label May 20, 2020
@jperedadnr
Copy link
Collaborator Author

/integrate

@openjdk openjdk bot added the sponsor Ready to sponsor label May 20, 2020
@openjdk
Copy link

openjdk bot commented May 20, 2020

@jperedadnr
Your change (at version 75febc5) is now ready to be sponsored by a Committer.

@kevinrushforth
Copy link
Member

/sponsor

@openjdk openjdk bot closed this May 20, 2020
@openjdk openjdk bot added integrated Pull request has been integrated and removed sponsor Ready to sponsor ready Ready to be integrated rfr Ready for review labels May 20, 2020
@openjdk
Copy link

openjdk bot commented May 20, 2020

@kevinrushforth @jperedadnr
Pushed as commit 37b5edc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
2 participants