JDK-8136999 : [macosx] NSException and NPE in a crash test
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 8,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2015-09-23
  • Updated: 2017-09-08
  • Resolved: 2017-08-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10
10 b23Fixed
Related Reports
Relates :  
Relates :  
Description
Run closed/java/awt/dnd/RemoveDropTargetCrashTest/RemoveDropTargetCrashTest.html on some jdk9 build (I tried b77, jake, and a PIT build for b84).
The test formally does pass, however  in the log there's a suspicious message from the Apple native code like the one you may see in the attachment,  reporting NSException and NPE.

On jdk8 fcs it fails with plain java NPE.
Comments
The added cases test/java/awt/dnd/RemoveDropTargetCrashTest/RemoveDropTargetCrashTest.java times out due to some other reason not related to the fix. The timeout issue is related to the issue https://bugs.openjdk.java.net/browse/JDK-8186002 and will be fixed with this issue.
11-08-2017

This is an AWT issue
16-08-2016

See the comment from the review: http://mail.openjdk.java.net/pipermail/awt-dev/2015-October/010201.html ----------------- Can you please clarify why this event flushing is necessary. As far as I understand we have this sequence of calls: performDragOperation: -> handleDropMessage -> postDropTargetEvent(....,DISPATCH_SYNC) -> postEvent to EDT -> block Appkit untill event is not dispatched -> unlock appkit and returns to performDragOperation: -> then do the same steps as previous two in flushEvents() () post+block+unlock Probably it was necessary before JDK-8006634 was implemented? -----------------
23-10-2015

The similar is for the test test/java/awt/dnd/MissingEventsOnModalDialog/MissingEventsOnModalDialogTest.java The window.dispose() call leads that fDropTargetContextPeer and fComponent becomes in the CDropTarget.m file. The MissingEventsOnModalDialogTest has one more problem with code: ------------ - (void)draggingEnded:(id <NSDraggingInfo>)sender { // If draggingDestination is nil route the message to the superclass: CDropTarget *dropTarget = self._dropTarget; if (dropTarget != nil) [dropTarget draggingEnded:sender]; else if ([super respondsToSelector:@selector(draggingEnded:)]) [super draggingEnded:sender]; } ------------ [super respondsToSelector:@selector(draggingEnded:)] does not check that the super object has respondsToSelector method. It just calls respondsToSelector method which is not overridden for the super object and results is the same as for [self respondsToSelector:@selector(draggingEnded:)] call. 2015-10-06 16:11:24.611 java[11580:d07] -[AWTView draggingEnded:]: unrecognized selector sent to instance 0x7fc182ea6d00 2015-10-06 16:11:24.615 java[11580:d07] -[AWTView draggingEnded:]: unrecognized selector sent to instance 0x7fc182ea6d00 2015-10-06 16:11:24.621 java[11580:d07] ( 0 CoreFoundation 0x00007fff832ef25c __exceptionPreprocess + 172 1 libobjc.A.dylib 0x00007fff88615e75 objc_exception_throw + 43 2 CoreFoundation 0x00007fff832f212d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 AppKit 0x00007fff862ca376 -[NSView(NSInternal) forwardInvocation:] + 179 4 CoreFoundation 0x00007fff8324d044 ___forwarding___ + 452 5 CoreFoundation 0x00007fff8324cdf8 _CF_forwarding_prep_0 + 120 6 libawt_lwawt.dylib 0x0000000124796e78 -[AWTView draggingEnded:] + 132 7 AppKit 0x00007fff85e6d8d6 NSCoreDragCompletionProc + 369 8 HIServices 0x00007fff8f349d03 DoTrackingMessage + 465 9 CoreFoundation 0x00007fff831e3936 __CFDictionaryApplyFunction_block_invoke + 22 10 CoreFoundation 0x00007fff831e38fc CFBasicHashApply + 124 11 CoreFoundation 0x00007fff831e384d CFDictionaryApplyFunction + 173 12 HIServices 0x00007fff8f349344 CoreDragStartDragging + 980 13 AppKit 0x00007fff85e6aa54 -[NSCoreDragManager _dragUntilMouseUp:accepted:] + 862 14 AppKit 0x00007fff860223a4 -[NSCoreDragManager dragImage:fromWindow:at:offset:event:pasteboard:source:slideBack:] + 1355 15 AppKit 0x00007fff8630885b -[NSWindow(NSDrag) dragImage:at:offset:event:pasteboard:source:slideBack:] + 133 16 libawt_lwawt.dylib 0x00000001247a425b -[CDragSource doDrag] + 489 17 Foundation 0x00007fff8abdf13e __NSThreadPerformPerform + 229 18 CoreFoundation 0x00007fff832205b1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 19 CoreFoundation 0x00007fff83211c62 __CFRunLoopDoSources0 + 242 20 CoreFoundation 0x00007fff832113ef __CFRunLoopRun + 831 21 CoreFoundation 0x00007fff83210e75 CFRunLoopRunSpecific + 309 22 HIToolbox 0x00007fff8c3b9a0d RunCurrentEventLoopInMode + 226 23 HIToolbox 0x00007fff8c3b97b7 ReceiveNextEventCommon + 479 24 HIToolbox 0x00007fff8c3b95bc _BlockUntilNextEventMatchingListInModeWithFilter + 65 25 AppKit 0x00007fff85b6024e _DPSNextEvent + 1434 26 AppKit 0x00007fff85b5f89b -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122 27 libosxapp.dylib 0x0000000124881f50 -[NSApplicationAWT nextEventMatchingMask:untilDate:inMode:dequeue:] + 122 28 AppKit 0x00007fff85b5399c -[NSApplication run] + 553 29 libosxapp.dylib 0x0000000124881d4d +[NSApplicationAWT runAWTLoopWithApp:] + 157 30 libawt_lwawt.dylib 0x00000001247c5b36 +[AWTStarter starter:headless:] + 834 31 JavaNativeFoundation 0x0000000123c87d16 +[JNFRunLoop _performCopiedBlock:] + 17 32 Foundation 0x00007fff8abdf13e __NSThreadPerformPerform + 229 33 CoreFoundation 0x00007fff832205b1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 34 CoreFoundation 0x00007fff83211c62 __CFRunLoopDoSources0 + 242 35 CoreFoundation 0x00007fff832113ef __CFRunLoopRun + 831 36 CoreFoundation 0x00007fff83210e75 CFRunLoopRunSpecific + 309 37 java 0x000000010440df01 CreateExecutionEnvironment + 934 38 java 0x000000010440a83d JLI_Launch + 1573 39 java 0x000000010441099f main + 286 40 java 0x0000000104409a04 start + 52
06-10-2015

DropTargetPanel.drop() method from the test sets DropTarget to null that leads to dropTarget.removeNotify() call, the drop target is disposed and fDropTargetContextPeer and fComponent becomes null in the -performDragOperation: method from CDropTarget.m file that leads to the NPE exception.
06-10-2015