Completion exception

I'm implementing custom completion in XML file. I don't know what causes this
exception. This is in 3455. Could someone (Dmitry?) give me a quick tip on what
I'm doing wrong? I don't think I'm returning any nulls where I shouldn't be.

Thank you very much


java.lang.NullPointerException
at com.intellij.psi.impl.source.xml.XmlTagImpl.getReferences(XmlTagImpl.java:28)
at
com.intellij.psi.impl.SharedPsiElementImplUtil.a(SharedPsiElementImplUtil.java:11)
at
com.intellij.psi.impl.SharedPsiElementImplUtil.findReferenceAt(SharedPsiElementImplUtil.java:15)
at
com.intellij.psi.impl.source.tree.LeafPsiElement.findReferenceAt(LeafPsiElement.java:18)
at
com.intellij.codeInsight.completion.CompletionData.findPrefixStatic(CompletionData.java:119)
at
com.intellij.codeInsight.completion.CompletionData.findPrefix(CompletionData.java:44)
at
com.intellij.codeInsight.completion.CodeCompletionHandlerBase.findPrefix(CodeCompletionHandlerBase.java:44)
at
com.intellij.codeInsight.completion.CodeCompletionHandlerBase.getLookupData(CodeCompletionHandlerBase.java:108)
at
com.intellij.codeInsight.completion.CodeCompletionHandlerBase.invoke(CodeCompletionHandlerBase.java:147)
at
com.intellij.codeInsight.actions.BaseCodeInsightAction$1$1.run(BaseCodeInsightAction.java)
at
com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:441)
at
com.intellij.codeInsight.actions.BaseCodeInsightAction$1.run(BaseCodeInsightAction.java:3)
at
com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:16)
at
com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:112)
at
com.intellij.codeInsight.actions.BaseCodeInsightAction.actionPerformedImpl(BaseCodeInsightAction.java:2)
at
com.intellij.codeInsight.completion.actions.CodeCompletionAction.actionPerformedImpl(CodeCompletionAction.java:6)
at
com.intellij.codeInsight.actions.BaseCodeInsightAction.actionPerformed(BaseCodeInsightAction.java:9)
at
com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.a(IdeKeyEventDispatcher.java:156)
at
com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.b(IdeKeyEventDispatcher.java:173)
at
com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:133)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:136)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:116)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:267)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:182)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

5 comments
Comment actions Permalink

Hello Keith,

KL> I'm implementing custom completion in XML file. I don't know what
KL> causes this exception. This is in 3455. Could someone (Dmitry?) give
KL> me a quick tip on what I'm doing wrong? I don't think I'm returning
KL> any nulls where I shouldn't be.

Is this repeatable and indeed from build 3455? There is no reasonable way
for the code to crash at that point - even if you had returned null from
PsiReferenceProvider.getReferencesByElement(), which you must not do, it
would have crashed earlier.

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0
Comment actions Permalink

Yes, it happens all the time. I don't know what I started doing to change it.

Dmitry Jemerov (JetBrains) wrote:

Hello Keith,

KL> I'm implementing custom completion in XML file. I don't know what
KL> causes this exception. This is in 3455. Could someone (Dmitry?) give
KL> me a quick tip on what I'm doing wrong? I don't think I'm returning
KL> any nulls where I shouldn't be.

Is this repeatable and indeed from build 3455? There is no reasonable
way for the code to crash at that point - even if you had returned null
from PsiReferenceProvider.getReferencesByElement(), which you must not
do, it would have crashed earlier.

0
Comment actions Permalink

Here it is from 5.0.1. It happens all the time even when I'm not invoking
completion.

java.lang.NullPointerException
at com.intellij.psi.impl.source.xml.XmlTagImpl.getReferences(XmlTagImpl.java:197)
at
com.intellij.codeInsight.daemon.impl.analysis.XmlHighlightVisitor.a(XmlHighlightVisitor.java:246)
at
com.intellij.codeInsight.daemon.impl.analysis.XmlHighlightVisitor.a(XmlHighlightVisitor.java:170)
at
com.intellij.codeInsight.daemon.impl.analysis.XmlHighlightVisitor.visitXmlToken(XmlHighlightVisitor.java:326)
at com.intellij.psi.impl.source.xml.XmlTokenImpl.accept(XmlTokenImpl.java:14)
at
com.intellij.codeInsight.daemon.impl.analysis.HighlightVisitorImpl.visitXmlElement(HighlightVisitorImpl.java:542)
at com.intellij.psi.XmlElementVisitor.visitXmlToken(XmlElementVisitor.java:58)
at com.intellij.psi.impl.source.xml.XmlTokenImpl.accept(XmlTokenImpl.java:14)
at
com.intellij.codeInsight.daemon.impl.analysis.HighlightVisitorImpl.visit(HighlightVisitorImpl.java:232)
at
com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass$1.run(GeneralHighlightingPass.java:9)
at
com.intellij.psi.impl.PsiManagerImpl.performActionWithFormatterDisabled(PsiManagerImpl.java:319)
at
com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.a(GeneralHighlightingPass.java:28)
at
com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.doCollectInformation(GeneralHighlightingPass.java:106)
at
com.intellij.codeInsight.daemon.impl.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:3)
at com.intellij.codeInsight.daemon.impl.UpdateThread$2.run(UpdateThread.java:7)
at
com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:113)
at com.intellij.codeInsight.daemon.impl.UpdateThread.a(UpdateThread.java:9)
at
com.intellij.codeInsight.daemon.impl.UpdateThread.access$100(UpdateThread.java:35)
at com.intellij.codeInsight.daemon.impl.UpdateThread$1.run(UpdateThread.java:2)
at
com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:16)
at com.intellij.codeInsight.daemon.impl.UpdateThread.run(UpdateThread.java:1)

Dmitry Jemerov (JetBrains) wrote:

Hello Keith,

KL> I'm implementing custom completion in XML file. I don't know what
KL> causes this exception. This is in 3455. Could someone (Dmitry?) give
KL> me a quick tip on what I'm doing wrong? I don't think I'm returning
KL> any nulls where I shouldn't be.

Is this repeatable and indeed from build 3455? There is no reasonable
way for the code to crash at that point - even if you had returned null
from PsiReferenceProvider.getReferencesByElement(), which you must not
do, it would have crashed earlier.

0
Comment actions Permalink

Hello Keith,

KL> Here it is from 5.0.1. It happens all the time even when I'm not
KL> invoking completion.
KL>
KL> java.lang.NullPointerException
KL> at
KL> com.intellij.psi.impl.source.xml.XmlTagImpl.getReferences(XmlTagImpl
KL> .java:197)

Well, now I understand what happens - and the reason for the crash is what
I originally mentioned, a return of null from an implementation of PsiReferenceProvider.getReferencesByElement().
It does crash at exactly this place. :)

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0
Comment actions Permalink

Dmitry Jemerov (JetBrains) wrote:

Hello Keith,

KL> Here it is from 5.0.1. It happens all the time even when I'm not
KL> invoking completion.
KL> KL> java.lang.NullPointerException
KL> at
KL> com.intellij.psi.impl.source.xml.XmlTagImpl.getReferences(XmlTagImpl
KL> .java:197)

Well, now I understand what happens - and the reason for the crash is
what I originally mentioned, a return of null from an implementation of
PsiReferenceProvider.getReferencesByElement(). It does crash at exactly
this place. :)


Now I feel dumb, I was returning PsiReference.EMPTY_ARRAY in all places but one.
Thanks. I hope you can somehow change this so the error is clearer.

0

Please sign in to leave a comment.