You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Muneyuki Noguchi (JIRA)" <ji...@apache.org> on 2016/05/03 06:43:13 UTC

[jira] [Created] (GROOVY-7832) NullPointerException in GroovyConsole with an input method

Muneyuki Noguchi created GROOVY-7832:
----------------------------------------

             Summary: NullPointerException in GroovyConsole with an input method
                 Key: GROOVY-7832
                 URL: https://issues.apache.org/jira/browse/GROOVY-7832
             Project: Groovy
          Issue Type: Bug
          Components: Groovy Console
    Affects Versions: 2.4.6
         Environment: OS X El Capitan (version 10.11.4), Google Japanese Input 2.17.2400.1 
            Reporter: Muneyuki Noguchi


When an input method is enabled and set focus to the Groovy Console, the Groovy Console sometimes throws NullPointerException.

Here is a message from the Groovy Console:
{code}
Exception in thread "AWT-EventQueue-0" 
java.lang.NullPointerException
	at groovy.ui.text.StructuredSyntaxDocumentFilter.replaceMetaCharacters(StructuredSyntaxDocumentFilter.java:285)
	at groovy.ui.text.StructuredSyntaxDocumentFilter.replace(StructuredSyntaxDocumentFilter.java:274)
	at javax.swing.text.AbstractDocument.replace(AbstractDocument.java:662)
	at javax.swing.JTextPane.replaceSelection(JTextPane.java:192)
	at javax.swing.JTextPane.replaceSelection(JTextPane.java:175)
	at groovy.ui.text.TextEditor.replaceSelection(TextEditor.java:367)
	at javax.swing.text.JTextComponent.replaceInputMethodText(JTextComponent.java:4767)
	at javax.swing.text.JTextComponent.processInputMethodEvent(JTextComponent.java:4506)
	at java.awt.Component.processEvent(Component.java:6298)
	at java.awt.Container.processEvent(Container.java:2229)
	at java.awt.Component.dispatchEventImpl(Component.java:4872)
	at java.awt.Container.dispatchEventImpl(Container.java:2287)
	at java.awt.Component.dispatchEvent(Component.java:4698)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
	at java.awt.EventQueue.access$200(EventQueue.java:103)
	at java.awt.EventQueue$3.run(EventQueue.java:694)
	at java.awt.EventQueue$3.run(EventQueue.java:692)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.awt.EventQueue$4.run(EventQueue.java:708)
	at java.awt.EventQueue$4.run(EventQueue.java:706)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
java.lang.reflect.InvocationTargetException
	at sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:572)
	at sun.lwawt.macosx.CInputMethod.attributedSubstringFromRange(CInputMethod.java:586)
Caused by: java.lang.IllegalArgumentException: Invalid substring range
	at java.text.AttributedString$AttributedStringIterator.<init>(AttributedString.java:756)
	at java.text.AttributedString.getIterator(AttributedString.java:583)
	at sun.lwawt.macosx.CInputMethod$3.run(CInputMethod.java:605)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:302)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
	at java.awt.EventQueue.access$200(EventQueue.java:103)
	at java.awt.EventQueue$3.run(EventQueue.java:694)
	at java.awt.EventQueue$3.run(EventQueue.java:692)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.awt.EventQueue$4.run(EventQueue.java:708)
	at java.awt.EventQueue$4.run(EventQueue.java:706)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Exception in thread "AWT-EventQueue-0" 
java.lang.NullPointerException
	at groovy.ui.text.StructuredSyntaxDocumentFilter.replaceMetaCharacters(StructuredSyntaxDocumentFilter.java:285)
	at groovy.ui.text.StructuredSyntaxDocumentFilter.replace(StructuredSyntaxDocumentFilter.java:274)
	at javax.swing.text.AbstractDocument.replace(AbstractDocument.java:662)
	at javax.swing.JTextPane.replaceSelection(JTextPane.java:192)
	at javax.swing.JTextPane.replaceSelection(JTextPane.java:175)
	at groovy.ui.text.TextEditor.replaceSelection(TextEditor.java:367)
	at javax.swing.text.JTextComponent.replaceInputMethodText(JTextComponent.java:4767)
	at javax.swing.text.JTextComponent.processInputMethodEvent(JTextComponent.java:4506)
	at java.awt.Component.processEvent(Component.java:6298)
	at java.awt.Container.processEvent(Container.java:2229)
	at java.awt.Component.dispatchEventImpl(Component.java:4872)
	at java.awt.Container.dispatchEventImpl(Container.java:2287)
	at java.awt.Component.dispatchEvent(Component.java:4698)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
	at java.awt.EventQueue.access$200(EventQueue.java:103)
	at java.awt.EventQueue$3.run(EventQueue.java:694)
	at java.awt.EventQueue$3.run(EventQueue.java:692)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.awt.EventQueue$4.run(EventQueue.java:708)
	at java.awt.EventQueue$4.run(EventQueue.java:706)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Exception in thread "AWT-EventQueue-0" 
java.lang.NullPointerException
	at groovy.ui.text.StructuredSyntaxDocumentFilter.replaceMetaCharacters(StructuredSyntaxDocumentFilter.java:285)
	at groovy.ui.text.StructuredSyntaxDocumentFilter.replace(StructuredSyntaxDocumentFilter.java:274)
	at javax.swing.text.AbstractDocument.replace(AbstractDocument.java:662)
	at javax.swing.JTextPane.replaceSelection(JTextPane.java:192)
	at javax.swing.JTextPane.replaceSelection(JTextPane.java:175)
	at groovy.ui.text.TextEditor.replaceSelection(TextEditor.java:367)
	at javax.swing.text.JTextComponent.replaceInputMethodText(JTextComponent.java:4767)
	at javax.swing.text.JTextComponent.processInputMethodEvent(JTextComponent.java:4506)
	at java.awt.Component.processEvent(Component.java:6298)
	at java.awt.Container.processEvent(Container.java:2229)
	at java.awt.Component.dispatchEventImpl(Component.java:4872)
	at java.awt.Container.dispatchEventImpl(Container.java:2287)
	at java.awt.Component.dispatchEvent(Component.java:4698)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
	at java.awt.EventQueue.access$200(EventQueue.java:103)
	at java.awt.EventQueue$3.run(EventQueue.java:694)
	at java.awt.EventQueue$3.run(EventQueue.java:692)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.awt.EventQueue$4.run(EventQueue.java:708)
	at java.awt.EventQueue$4.run(EventQueue.java:706)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
java.lang.reflect.InvocationTargetException
	at sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:572)
	at sun.lwawt.macosx.CInputMethod.characterIndexForPoint(CInputMethod.java:757)
Caused by: java.lang.NullPointerException
	at javax.swing.text.JTextComponent$InputMethodRequestsHandler.getLocationOffset(JTextComponent.java:4651)
	at sun.awt.im.InputMethodContext.getLocationOffset(InputMethodContext.java:286)
	at sun.lwawt.macosx.CInputMethod$7.run(CInputMethod.java:759)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:302)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
	at java.awt.EventQueue.access$200(EventQueue.java:103)
	at java.awt.EventQueue$3.run(EventQueue.java:694)
	at java.awt.EventQueue$3.run(EventQueue.java:692)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.awt.EventQueue$4.run(EventQueue.java:708)
	at java.awt.EventQueue$4.run(EventQueue.java:706)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
java.lang.reflect.InvocationTargetException
	at sun.lwawt.macosx.LWCToolkit.invokeAndWait(LWCToolkit.java:572)
	at sun.lwawt.macosx.CInputMethod.characterIndexForPoint(CInputMethod.java:757)
Caused by: java.lang.NullPointerException
	at javax.swing.text.JTextComponent$InputMethodRequestsHandler.getLocationOffset(JTextComponent.java:4651)
	at sun.awt.im.InputMethodContext.getLocationOffset(InputMethodContext.java:286)
	at sun.lwawt.macosx.CInputMethod$7.run(CInputMethod.java:759)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:302)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
	at java.awt.EventQueue.access$200(EventQueue.java:103)
	at java.awt.EventQueue$3.run(EventQueue.java:694)
	at java.awt.EventQueue$3.run(EventQueue.java:692)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.awt.EventQueue$4.run(EventQueue.java:708)
	at java.awt.EventQueue$4.run(EventQueue.java:706)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
{code}

Here is a message from Terminal.app:
{code}
$ bin/groovyConsole
^[[A2016-05-03 13:22:04.418 java[2464:278618] An uncaught exception was raised
2016-05-03 13:22:04.418 java[2464:278618] NSConcreteAttributedString initWithString:: nil value
2016-05-03 13:22:04.421 java[2464:278618] (
	0   CoreFoundation                      0x00007fff903554f2 __exceptionPreprocess + 178
	1   libobjc.A.dylib                     0x00007fff88c7073c objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff903bc4bd +[NSException raise:format:] + 205
	3   Foundation                          0x00007fff8e4b5255 -[NSConcreteAttributedString initWithString:] + 132
	4   liblwawt.dylib                      0x000000011b3193fe -[AWTView attributedSubstringForProposedRange:actualRange:] + 135
	5   AppKit                              0x00007fff87fba58d -[NSTextInputContext(NSInputContext_WithCompletion) attributedSubstringForProposedRange:completionHandler:] + 105
	6   AppKit                              0x00007fff87fb60a2 __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke_3520 + 115
	7   AppKit                              0x00007fff87fb361a -[NSTextInputContext tryHandleTSMEvent_attributedSubstringForProposedRange_withContext:dispatchCondition:dispatchWork:continuation:] + 101
	8   AppKit                              0x00007fff87fb6005 __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke516 + 461
	9   AppKit                              0x00007fff87fb5d09 __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke_2499 + 474
	10  AppKit                              0x00007fff87fba873 -[NSTextInputContext(NSInputContext_WithCompletion) firstRectForCharacterRange:completionHandler:] + 397
	11  AppKit                              0x00007fff87fb5b24 __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke498 + 198
	12  AppKit                              0x00007fff87fb3279 __178-[NSTextInputContext tryHandleTSMEvent_offsetToPos_markedOrSelRange_withContext:markedOrSelRangeDispatchCondition:markedRangeContinuation:selectedRangeContinuation:continuation:]_block_invoke + 99
	13  AppKit                              0x00007fff87fb3209 -[NSTextInputContext tryHandleTSMEvent_offsetToPos_markedOrSelRange_withContext:markedOrSelRangeDispatchCondition:markedRangeContinuation:selectedRangeContinuation:continuation:] + 213
	14  AppKit                              0x00007fff87fb56cb __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke461 + 372
	15  AppKit                              0x00007fff878a4947 -[NSTextInputContext handleTSMEvent:completionHandler:] + 2429
	16  AppKit                              0x00007fff878a3f5e _NSTSMEventHandler + 324
	17  HIToolbox                           0x00007fff948987be _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 1231
	18  HIToolbox                           0x00007fff94897c48 _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 404
	19  HIToolbox                           0x00007fff94897aab SendEventToEventTargetWithOptions + 43
	20  HIToolbox                           0x00007fff948ecf7d SendTSMEvent_WithCompletionHandler + 417
	21  HIToolbox                           0x00007fff94a9f105 __SendTextInputEvent_WithCompletionHandler_block_invoke + 586
	22  HIToolbox                           0x00007fff94a9d3fd SendTextInputEvent_WithCompletionHandler + 1228
	23  HIToolbox                           0x00007fff94b09474 -[IMKInputSession _postEvent:completionHandler:] + 184
	24  HIToolbox                           0x00007fff94b09336 -[IMKInputSession _createAndSendOffsetToPointEvent:completionHandler:] + 300
	25  HIToolbox                           0x00007fff94b1d014 -[IMKInputSession attributesForCharacterIndex_andLineRect:completionHandler:] + 597
	26  HIToolbox                           0x00007fff94b1dcc8 -[IMKInputSession attributesForCharacterIndex:completionHandler:] + 113
	27  HIToolbox                           0x00007fff94b0b19b __60-[IMKInputSession imkxpc_attributesForCharacterIndex:reply:]_block_invoke + 502
	28  CoreFoundation                      0x00007fff902ea4ac __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
	29  CoreFoundation                      0x00007fff902c9d05 __CFRunLoopDoBlocks + 341
	30  CoreFoundation                      0x00007fff902c94ce __CFRunLoopRun + 910
	31  CoreFoundation                      0x00007fff902c8ed8 CFRunLoopRunSpecific + 296
	32  HIToolbox                           0x00007fff948c0935 RunCurrentEventLoopInMode + 235
	33  HIToolbox                           0x00007fff948c0677 ReceiveNextEventCommon + 184
	34  HIToolbox                           0x00007fff948c05af _BlockUntilNextEventMatchingListInModeWithFilter + 71
	35  AppKit                              0x00007fff876fdefa _DPSNextEvent + 1067
	36  AppKit                              0x00007fff876fd32a -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
	37  libosxapp.dylib                     0x000000011b16a4e3 -[NSApplicationAWT nextEventMatchingMask:untilDate:inMode:dequeue:] + 124
	38  AppKit                              0x00007fff876f1e84 -[NSApplication run] + 682
	39  libosxapp.dylib                     0x000000011b16a346 +[NSApplicationAWT runAWTLoopWithApp:] + 156
	40  liblwawt.dylib                      0x000000011b30c539 -[AWTStarter starter:] + 873
	41  Foundation                          0x00007fff8e4dcf5e __NSThreadPerformPerform + 279
	42  CoreFoundation                      0x00007fff902ea881 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
	43  CoreFoundation                      0x00007fff902c9fbc __CFRunLoopDoSources0 + 556
	44  CoreFoundation                      0x00007fff902c94df __CFRunLoopRun + 927
	45  CoreFoundation                      0x00007fff902c8ed8 CFRunLoopRunSpecific + 296
	46  java                                0x000000010fbd23b0 CreateExecutionEnvironment + 871
	47  java                                0x000000010fbccb5c JLI_Launch + 1952
	48  java                                0x000000010fbd270d main + 101
	49  java                                0x000000010fbcc3b4 start + 52
	50  ???                                 0x0000000000000011 0x0 + 17
)
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)