--- old/src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m 2016-09-27 10:55:54.000000000 +0530 +++ new/src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m 2016-09-27 10:55:54.000000000 +0530 @@ -67,6 +67,7 @@ // happen with z-order. static int gsEventNumber; static int* gsButtonEventNumber; +static CRobotKeyCodeMapping *keyCodeMapping; static inline CGKeyCode GetCGKeyCode(jint javaKeyCode); @@ -130,6 +131,7 @@ gsButtonEventNumber[i] = ROBOT_EVENT_NUMBER_START; } } + keyCodeMapping = [CRobotKeyCodeMapping sharedInstance]; } /* @@ -344,8 +346,10 @@ static inline CGKeyCode GetCGKeyCode(jint javaKeyCode) { - CRobotKeyCodeMapping *keyCodeMapping = [CRobotKeyCodeMapping sharedInstance]; - return [keyCodeMapping getOSXKeyCodeForJavaKey:javaKeyCode]; + if (keyCodeMapping) { + return [keyCodeMapping getOSXKeyCodeForJavaKey:javaKeyCode]; + } + return OSX_Undefined; } static int GetClickCount(BOOL isDown) { --- old/src/java.desktop/macosx/native/libawt_lwawt/awt/CRobotKeyCode.m 2016-09-27 10:55:56.000000000 +0530 +++ new/src/java.desktop/macosx/native/libawt_lwawt/awt/CRobotKeyCode.m 2016-09-27 10:55:55.000000000 +0530 @@ -45,7 +45,7 @@ self = [super init]; if (nil != self) { - javaToMacKeyMap = [NSDictionary dictionaryWithObjectsAndKeys : + self.javaToMacKeyMap = [NSDictionary dictionaryWithObjectsAndKeys : [NSNumber numberWithInt : OSX_Delete], [NSNumber numberWithInt : java_awt_event_KeyEvent_VK_BACK_SPACE], [NSNumber numberWithInt : OSX_kVK_Tab], [NSNumber numberWithInt : java_awt_event_KeyEvent_VK_TAB], [NSNumber numberWithInt : OSX_kVK_Return], [NSNumber numberWithInt : java_awt_event_KeyEvent_VK_ENTER],