JDK-8154864 : com.apple.eawt GestureListener - JavaNativeException on three finger tap gesture
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 8u77,9
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: other
  • CPU: x86
  • Submitted: 2016-04-09
  • Updated: 2016-06-30
  • Resolved: 2016-06-30
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Darwin JBookAir.local 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64

EXTRA RELEVANT SYSTEM CONFIGURATION :
Macbook Air 11" (Mid 2013), Macbook Air 13" (Mid 2013)

A DESCRIPTION OF THE PROBLEM :
When listening to gesture events using the com.apple.eawt classes and adding either a SwipeListener (which is generally broken), a MagnificationListener or a RotationListener to the GestureUtilities a JavaNativeException is being raised when tapping with three fingers on a gesture-compatible device (Trackpad of the Macbook) at the previously selected JComponent.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Apply either a SwipeListener, a MagnificationListener or a RotationListener to a JComponent and tap on it using a three-finger tap gesture. 

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Event should be somehow consumed without an error message by the JVM.
ACTUAL -
The JVM caughts a JavaNativeException and prints it to STDERR

ERROR MESSAGES/STACK TRACES THAT OCCUR :
2016-04-09 04:31:42.508 java[924:84711] Lookup: Unhandled exception 'JavaNativeException' caught in +[LULookupDefinitionModule _focusTermUsingQueue:handler:]

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
		
		JPanel p = new JPanel();
		
		JFrame f = new JFrame("Title here");
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		f.setContentPane(p);

		GestureUtilities.addGestureListenerTo(p, new MagnificationListener() {
			@Override
			public void magnify(MagnificationEvent e) {
				System.out.println(e.getMagnification());
			}
		});

		GestureUtilities.addGestureListenerTo(p, new RotationListener() {
			@Override
			public void rotate(RotationEvent e) {
				System.out.println(e.getRotation());
			}
		});
		
		f.setVisible(true);
---------- END SOURCE ----------


Comments
As stated in http://openjdk.java.net/jeps/260, a replacement to this internal API has been provided [1] in JDK 9 and com.apple.eawt will be encapsulated. The command-line workaround to break encapsulation could be used before migrating to the new API. Close this issue as will not fix. [1] http://openjdk.java.net/jeps/272
30-06-2016