Project

General

Profile

Defect #1209

DndFile bean does not work on Mac in SmartClient with Java 8

Added by Alexander Stefan about 7 years ago. Updated over 6 years ago.

Status:
Parked
Priority:
Normal
Start date:
04/03/2017
Due date:
% Done:

0%

Estimated time:
Browser (if web client):

Description

Hi,

we've noticed an issue when using the DndFile bean on Mac OS.
On Servoy 5 with Java 6 everything worked fine. Now we've updated our customer to Servoy 7.4.8 and the customer reported the issue, that files can't be drag&dropped to Servoy anymore.
It would be great, if you could have a look on it!

Thanks a lot!
Alex

Environment:

DndFile Bean 1.2.8
Servoy 7.4.8
Java: 1.8.0_121
Mac OS: 10.12.3

Desc:

When i start the SmartClient the onDrop Method gets an empty array with no files.
On Windows with same Java version everything works fine.
On Mac when i use Servoy Developer 7.4.9 and DndFile Bean 1.2.8 it also works great.

I tried both bean with visible flag checked and invisible - same result.


Files

DndFileTest.servoy (3.5 KB) DndFileTest.servoy Alexander Stefan, 04/03/2017 11:02 AM
log1.txt (2 KB) log1.txt Alexander Stefan, 04/03/2017 03:32 PM
log2.txt (850 Bytes) log2.txt Alexander Stefan, 04/03/2017 03:32 PM
log3.txt (852 Bytes) log3.txt Alexander Stefan, 04/03/2017 03:32 PM
log4_mac.txt (2.19 KB) log4_mac.txt Alexander Stefan, 04/04/2017 09:24 AM
log5_windows.txt (2.79 KB) log5_windows.txt Alexander Stefan, 04/04/2017 09:24 AM

History

#1

Updated by Alexander Stefan about 7 years ago

You can try it on the attached Sample Solution.

#2

Updated by Patrick Talbot about 7 years ago

  • Status changed from New to Feedback
  • Assignee set to Alexander Stefan

Not sure I'm following you're saying it doesn't work on Mac 7.4.8 with Java 8 but then you say it's working in 7.4.9?

Or is it in a real Smart client only?

If so, are you sure the jars are properly loaded (no security issue with certificates)?
And could you activate the console in web start and send me an output of any exception in the console when it's not working?

#3

Updated by Alexander Stefan about 7 years ago

Sorry for the confusing description...

You're right - the issue is Smart client only on Mac with Java 8.
I've tried it on Servoy Developer 7.4.9 on Mac and it worked fine - but not in SmartClient.

Now i've added 3 log files from the Java console.

log1.txt and log2.txt are from customer servers with Servoy 7.4.8.
log3.txt is the log from a new setup Servoy 7.4.9 server on my local maschine.
I've only downloaded the dndfile bean, configured database drivers and the servoy.properties file.
When i connect with a Windows SmartClient it dnd works, but not for Mac.

Do i have to configure something else for SmartClient?

Can you reproduce the issue on a Mac (if you have a Mac available)?

Thanks for your quick response!

#4

Updated by Patrick Talbot about 7 years ago

I have a mac but it's not up to date and I will probably not be able to update it to the latest OS X.

What I see from your log 1 is that the drop contains a flavor of text/uri-list; which looks like it is a list of paths, which seems to be a new way Mac OS X is sending information about the files dropped. I don't remember it was the case before.

Not sure I handle these uri-list, but I'll check.
Still, there seems to be a bug in JDK 8 on Mac OS X where the list is concatenated, so it's impossible to know where one file URI stops and the next starts(see https://bugs.openjdk.java.net/browse/JDK-8160941 ) if that's the case here, I'm not sure I'll be able to fix this, since this is a bug in Mac OS X JDK.

Does this work if you drop only one file?

#5

Updated by Alexander Stefan about 7 years ago

Thanks for your investigations!

I don't know if it's important to update your Mac to the latest OS X version.
Maybe it's enough to install Java 8, because my customer had no problems when using Servoy 5 and Java 6 with the latest OS X version.

In the three logs i've always chosen just one file.

#6

Updated by Patrick Talbot about 7 years ago

Could you update to v1.2.9 and report please? Thanks.

#7

Updated by Alexander Stefan about 7 years ago

Hi Patrick,

thank you very much for the new release 1.2.9! Great work!

I've tried it and now on Mac i can drag&drop 1 file successfully!

Unfortunately there's an issue when i drop more than 1 file.
I've attached the log files with the results.
When i select 2 files, no file will be dropped
When i select 3 files, the last selected file will be dropped
When i select 4 files, the last both selected files will be dropped
and so on...

I also tested the new version on Windows 10.
It still works, but there are some erros in the log (I think the errors are not new):
e.g. INFORMATION: Drop failed: java.awt.dnd.DropTargetDropEvent[source=java.awt.dnd.DropTarget@4a2a6f]
I just wondered why this message appears when the file is dropped successfully.
You can see the Windows log in the other log file.

Thanks!

#8

Updated by Alexander Stefan about 7 years ago

Hi Patrick,

do you have any idea whats the difference when dropping more than one file?

#9

Updated by Patrick Talbot about 7 years ago

My guess is that it has to do with the Transfer object received by Java for the url-list formatted in a weird manner.

It's supposed to be a list of url/paths, one per line, but I've seen various reports of bugs similar to https://bugs.openjdk.java.net/browse/JDK-8160941 for Mac OS X.

Not sure how I can find a fix. I'll get to it when I can find the time but it's going to be tedious to find a workaround...

#10

Updated by Alexander Stefan over 6 years ago

Hi Patrick,

today i've tested the Drag&Drop issue on Java 8 Update 144 on Mac.
Unfortunately the bug still exists :-(
Our customer loves to take a bunch of files at once and drop them on the bean, but this is not possible on Java 8.
Do you think you can create a workaround for this Java bug?

Thank you very much!
Alex

#11

Updated by Alexander Stefan over 6 years ago

Hi Patrick,

same result while testing Java 8 Update 151 on Mac :-(
It would be great, if you can find a workaround, because my customer is used to drop multiple files in their daily business.

Thanks a lot!
Alex

#12

Updated by Alexander Stefan over 6 years ago

Hi Patrick,

today i've found a workaround for Macs! :-)
I've tried the native Drag&Drop feature from Servoy 7 and parsed the received JSDNDEvent object.
The event object contains the dataMimeType property with value 'application/x-java-file-list; class=java.util.List'.
The event.data property contains the dropped file names. The behaviour is the same like in the DnDBean:

1 file: works
2 files: both filenames are given in one string.
3 and more files: the first two files are in the first row, all following files are in seperate rows, so i can call a split('\\n') to receive the rows.

Now i check with JSFile.exists() if a filename exists on the file system.
The row which contains two file names has a special method which extracts the two file names.
This method call split('/') on the string, which contains the two file names.
I iterate over the spitted array, add a '/' on each item and check if it exists on the file system.
So i build the path step for step.
At the moment the second file name begins, i get a 'false' from the exists() method.
This is the moment i know where file 1 ends and file 2 begins.

It's very ugly but with this way i can drop multiple files on Java 8 on Mac again :-)

If you have the time, you can implement this workaround in your bean as well.
But now with my workaround it's not urgent any more ;-)

Alex

#13

Updated by Patrick Talbot over 6 years ago

  • Status changed from Feedback to Parked

Glad to hear you've found a workaround, Alexander!
It is messy indeed. But I'm not surprised.

My main issue is that I cannot really reproduce on my end, with a Mac that is out of date, so I cannot trace it and am pretty much in the dark.

The workaround you found could eventually be integrated but it's such a special implementation based on OS+Java that there will be a need to implement within quite a few platform tests.

So I will have to park that one for now and see if that happens on other platforms/future java, in which case I might be able to do something about it.

Also available in: Atom PDF