This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 186587

Summary: NullPointerException at org.netbeans.modules.web.core.syntax.completion.ElCompletionProvider.isAfterElDelimiter
Product: javaee Reporter: Peter Pis <ppis>
Component: JSPAssignee: Tomasz Slota <tslota>
Status: VERIFIED FIXED    
Severity: normal CC: mfukala, mmetelka, pjiricka, vstejskal
Priority: P1    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 169429
Attachments: stacktrace

Description Peter Pis 2010-05-24 08:55:42 UTC
Build: NetBeans IDE 6.9 RC1 (Build 201005202201)
VM: Java HotSpot(TM) Client VM, 16.0-b13, Java(TM) SE Runtime Environment, 1.6.0_18-b06
OS: Linux

User Comments:
ppis: Trying to edit jsp file.

GUEST: Editing a .jsp file. Happened when I hit my enter key to add a new line.

The jsp file was not being parsed (syntax highlighting)




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.web.core.syntax.completion.ElCompletionProvider.isAfterElDelimiter(ElCompletionProvider.java:98)
   at org.netbeans.modules.web.core.syntax.completion.ElCompletionProvider.getAutoQueryTypes(ElCompletionProvider.java:91)
   at org.netbeans.modules.editor.completion.CompletionImpl.insertUpdate(CompletionImpl.java:315)
   at org.netbeans.lib.editor.util.swing.PriorityDocumentListenerList.insertUpdate(PriorityDocumentListenerList.java:82)
   at javax.swing.text.AbstractDocument.fireInsertUpdate(AbstractDocument.java:185)
   at org.netbeans.editor.BaseDocument.fireInsertUpdate(BaseDocument.java:1661)
Comment 1 Peter Pis 2010-05-24 08:55:45 UTC
Created attachment 99376 [details]
stacktrace
Comment 2 Peter Pis 2010-05-24 08:56:31 UTC
P1.
Comment 3 Petr Jiricka 2010-05-24 09:57:55 UTC
I can't reproduce. Can anyone who can reproduce please attach reproducible steps, or the file on which this is happening?
Comment 4 Tomasz Slota 2010-05-24 10:39:02 UTC
The problem happened due to token.text() returning unexpected 'null', so it can be very rare/difficult to reproduce.

Adding a simple NPE check may or may not be the right solution, I am investigating it..
Comment 5 Peter Pis 2010-05-24 11:27:36 UTC
After clearing the user directory, I am not able to reproduce it.
Comment 6 Michal Mocnak 2010-05-24 12:10:38 UTC
I am unable to reproduce as well but it should be nice to add at least NPE check ? Keeping it as P1
Comment 7 Tomasz Slota 2010-05-24 14:16:34 UTC
It was actually not token.getText() returning null, but tokenHierarchy.tokenSequence() returning null.

This situation was made possibe after some recent performance optimizations implemented by Mila (token hierarchy is switched off during formatting and undo actions), but anyways tokenHierarchy.tokenSequence() should be always checked for null, therefore adding a simple NPE is a legitimate solution.

It's been already done in trunk:

http://hg.netbeans.org/web-main/rev/1fe417dc3a0d
Comment 8 Tomasz Slota 2010-05-24 14:20:07 UTC
Vito, please review the fix
Comment 9 Marek Fukala 2010-05-24 15:05:25 UTC
The fix is OK.
Comment 10 Tomasz Slota 2010-05-24 15:38:04 UTC
The fix was integrated to the release69 branch:

http://hg.netbeans.org/release69/rev/82a28abb0221
Comment 11 Quality Engineering 2010-05-25 07:32:05 UTC
Integrated into 'main-golden', will be available in build *201005250001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/1fe417dc3a0d
User: Tomasz Slota <tslota@netbeans.org>
Log: #186587: NullPointerException at org.netbeans.modules.web.core.syntax.completion.ElCompletionProvider.isAfterElDelimiter
Comment 12 Martin Schovanek 2010-05-25 12:20:33 UTC
Verified in the RC1 build by QE.
Comment 13 Martin Schovanek 2010-05-25 12:26:49 UTC
v.