Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 476535

Summary: java.lang.NumberFormatException in DropTargetOperationHandler.createDropData on Internet Explorer when zoomed
Product: [RT] RAP Reporter: Hannes Erven <hannes>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M3   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Hannes Erven CLA 2015-09-03 06:55:25 EDT
When using DropListeners in RAP, Internet Explorer (11.0.9600.17959) seems to supply coordinate values with fractions instead of ints when zoomed in. DropTargetOperationHandler extracts the coordinates via JsonNumber.asInt() and that obviously fails with the following exception:

java.lang.NumberFormatException: For input string: "1002.6699829101562"
	at java.lang.NumberFormatException.forInputString(Unknown Source)
	at java.lang.Integer.parseInt(Unknown Source)
	at org.eclipse.rap.json.JsonNumber.asInt(JsonNumber.java:45)
	at org.eclipse.swt.internal.dnd.droptargetkit.DropTargetOperationHandler.createDropData(DropTargetOperationHandler.java:347)
	at org.eclipse.swt.internal.dnd.droptargetkit.DropTargetOperationHandler.access$11(DropTargetOperationHandler.java:343)
	at org.eclipse.swt.internal.dnd.droptargetkit.DropTargetOperationHandler$5.run(DropTargetOperationHandler.java:271)
	at org.eclipse.rap.rwt.internal.lifecycle.ProcessActionRunner.executeNext(ProcessActionRunner.java:50)
	at org.eclipse.swt.widgets.Display.runPendingMessages(Display.java:1191)


A related issue might have been reported and fixed in https://bugs.eclipse.org/bugs/show_bug.cgi?id=394093 by using Math.round().


I haven't been able to reproduce this issue on Firefox or Chrome.
Comment 1 Ivan Furnadjiev CLA 2015-09-10 07:59:27 EDT
Fixed with change https://git.eclipse.org/r/#/c/55616/
Comment 2 Hannes Erven CLA 2015-09-28 12:17:26 EDT
Tested with nightly build from 2015-09-22 - NOT fixed.

I was able to trace the JavaScript event handling to the function "_sendDropAccept" which still sends float values as coordinates.

https://github.com/eclipse/rap/blob/master/bundles/org.eclipse.rap.rwt/js/rwt/widgets/DropTarget.js


Thank you!
Comment 3 Ivan Furnadjiev CLA 2015-10-01 02:59:09 EDT
(In reply to comment #2)
> Tested with nightly build from 2015-09-22 - NOT fixed.
> 
> I was able to trace the JavaScript event handling to the function
> "_sendDropAccept" which still sends float values as coordinates.
> 
> https://github.com/eclipse/rap/blob/master/bundles/org.eclipse.rap.rwt/js/rwt/widgets/DropTarget.js
> 
> 
> Thank you!

 Fixed with change https://git.eclipse.org/r/#/c/56922/