RFR: 8245456: MacPasteboard throws ClassCastException on static builds

Kevin Rushforth kcr at openjdk.java.net
Wed May 20 12:24:32 UTC 2020


On Wed, 20 May 2020 11:47:29 GMT, Jose Pereda <jpereda at openjdk.org> wrote:

> 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](https://docs.oracle.com/en/java/javase/11/docs/specs/jni/functions.html#findclass).
> It has been tested on Mac OS, both with and without static build.

Marked as reviewed by kcr (Lead).

-------------

PR: https://git.openjdk.java.net/jfx/pull/228


More information about the openjfx-dev mailing list