diff --git a/modules/javafx.graphics/src/main/native-glass/gtk/GlassSystemClipboard.cpp b/modules/javafx.graphics/src/main/native-glass/gtk/GlassSystemClipboard.cpp --- a/modules/javafx.graphics/src/main/native-glass/gtk/GlassSystemClipboard.cpp +++ b/modules/javafx.graphics/src/main/native-glass/gtk/GlassSystemClipboard.cpp @@ -387,7 +387,7 @@ } -static jobject get_data_raw(JNIEnv *env, const char* mime, gboolean string_data) +static jobject get_data_raw(JNIEnv *env, const char* mime) { GtkSelectionData *data; const guchar *raw_data; @@ -397,17 +397,12 @@ data = gtk_clipboard_wait_for_contents(get_clipboard(), gdk_atom_intern(mime, FALSE)); if (data != NULL) { raw_data = glass_gtk_selection_data_get_data_with_length(data, &length); - if (string_data) { - result = createUTF(env, (char*)raw_data); - EXCEPTION_OCCURED(env); - } else { - array = env->NewByteArray(length); - EXCEPTION_OCCURED(env); - env->SetByteArrayRegion(array, 0, length, (const jbyte*)raw_data); - EXCEPTION_OCCURED(env); - result = env->CallStaticObjectMethod(jByteBufferCls, jByteBufferWrap, array); - EXCEPTION_OCCURED(env); - } + array = env->NewByteArray(length); + EXCEPTION_OCCURED(env); + env->SetByteArrayRegion(array, 0, length, (const jbyte*)raw_data); + EXCEPTION_OCCURED(env); + result = env->CallStaticObjectMethod(jByteBufferCls, jByteBufferWrap, array); + EXCEPTION_OCCURED(env); gtk_selection_data_free(data); } return result; @@ -543,13 +538,13 @@ } else if (g_strcmp0(cmime, "text/uri-list") == 0) { result = get_data_uri_list(env, FALSE); } else if (g_str_has_prefix(cmime, "text/")) { - result = get_data_raw(env, cmime, TRUE); + result = get_data_text(env); } else if (g_strcmp0(cmime, "application/x-java-file-list") == 0) { result = get_data_uri_list(env, TRUE); } else if (g_strcmp0(cmime, "application/x-java-rawimage") == 0 ) { result = get_data_image(env); } else { - result = get_data_raw(env, cmime, FALSE); + result = get_data_raw(env, cmime); } LOG_EXCEPTION(env) env->ReleaseStringUTFChars(mime, cmime);