JDK-8074256 : NPE: Null AppContext in CInputMethod.insertText running in AppKit Thread
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 8u25
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • CPU: x86
  • Submitted: 2014-12-16
  • Updated: 2015-03-03
  • Resolved: 2015-03-03
Related Reports
Duplicate :  
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
MAC OS X Yosemite 10.10.1
uname -a:
Darwin administrator-iMac.local 14.0.0 Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64

EXTRA RELEVANT SYSTEM CONFIGURATION :
Applet tested in Firefox 34.0.5 and Chrome 39.0.2171.95 (64-bit)

A DESCRIPTION OF THE PROBLEM :
Our web application uses richtext editor written as java applet. This applet uses dialogs to f.e. create a hypertext link with a custom name. But typing non-ascii characters - locale dependent, doesnt work anymore. They are handled by the class CInputMethod in a thread that most probably was started in a different threadgroup than the applet and so calling AppContext.getAppContext() returns null which causes nullpointer exception when typing non-ascii chars. The problem does not occur on windows. This problem does not occur when the applet is launched as standalone app, it occurs only with WebStart.

REGRESSION.  Last worked in version 7u45

ADDITIONAL REGRESSION INFORMATION: 
Regression is kinda hard to on mac since every older version refuses to install on OS X 10.10.1 stating that I need OS X 10.7.3 and later... For some reason I was able to install 7u11 where this problem wasnt present but any newer failed for reasons stated above.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Launch an applet using WebStart, open a dialog with some form of text input and try to type some national characters - they shouldnt appear. Upon further inspection with remote debug a stacktrace with NPE similar to that I enclosed should pop up.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The ablity to type non-ascii characters in applet dialogs.
ACTUAL -
The inability to type non-ascii characters in applet dialogs, because the thread thros NullPointerException.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Daemon System Thread [AppKit Thread] (Suspended (entry into method <init> in NullPointerException))	
	owns: CInputMethod  (id=74)	
	NullPointerException.<init>() line: 60 [local variables unavailable]	
	SunToolkit.getSystemEventQueueImplPP(AppContext) line: 1080	
	SunToolkit.getSystemEventQueueImplPP() line: 1075	
	LWCToolkit(SunToolkit).getSystemEventQueueImpl() line: 1070	
	Toolkit.getEventQueue() line: 1734	
	EventQueue.getMostRecentEventTime() line: 792	
	InputMethodEvent.<init>(Component, int, AttributedCharacterIterator, int, TextHitInfo, TextHitInfo) line: 220	
	CInputMethod.insertText(String) line: 431	

REPRODUCIBILITY :
This bug can be reproduced always.