Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException occurs multiple times #46

Closed
stavstrom opened this issue Mar 9, 2022 · 8 comments
Closed

NullPointerException occurs multiple times #46

stavstrom opened this issue Mar 9, 2022 · 8 comments

Comments

@stavstrom
Copy link

version: 0.12.191.8026. Stacktrace:

java.lang.NullPointerException
at com.millennialmedia.intellibot.psi.ref.RobotFileManager.findFile(RobotFileManager.java:197)
at com.millennialmedia.intellibot.psi.ref.RobotFileManager.findGlobalFile(RobotFileManager.java:173)
at com.millennialmedia.intellibot.psi.ref.RobotFileManager.findRobot(RobotFileManager.java:61)
at com.millennialmedia.intellibot.psi.ref.RobotArgumentReference.resolveResource(RobotArgumentReference.java:69)
at com.millennialmedia.intellibot.psi.ref.RobotArgumentReference.resolve(RobotArgumentReference.java:35)
at com.millennialmedia.intellibot.psi.element.HeadingImpl.resolveImport(HeadingImpl.java:531)
at com.millennialmedia.intellibot.psi.element.HeadingImpl.collectImportFiles(HeadingImpl.java:357)
at com.millennialmedia.intellibot.psi.element.HeadingImpl.getImportedFiles(HeadingImpl.java:339)
at com.millennialmedia.intellibot.psi.element.RobotFileImpl.getImportedFiles(RobotFileImpl.java:141)
at com.millennialmedia.intellibot.psi.ref.ResolverUtils.resolveKeywordFromFile(ResolverUtils.java:46)
at com.millennialmedia.intellibot.psi.ref.RobotKeywordReference.resolve(RobotKeywordReference.java:31)
at com.intellij.psi.impl.source.resolve.reference.impl.PsiMultiReference.resolves(PsiMultiReference.java:51)
at com.intellij.psi.impl.source.resolve.reference.impl.PsiMultiReference.lambda$static$0(PsiMultiReference.java:35)
at java.base/java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
at java.base/java.util.TimSort.sort(TimSort.java:220)
at java.base/java.util.Arrays.sort(Arrays.java:1441)
at com.intellij.psi.impl.source.resolve.reference.impl.PsiMultiReference.chooseReference(PsiMultiReference.java:70)
at com.intellij.psi.impl.source.resolve.reference.impl.PsiMultiReference.getRangeInElement(PsiMultiReference.java:88)
at com.intellij.psi.ReferenceRange.getRanges(ReferenceRange.java:20)
at com.intellij.codeInsight.completion.CompletionUtil.findReferencePrefix(CompletionUtil.java:162)
at com.intellij.codeInsight.completion.CompletionData.getReferencePrefix(CompletionData.java:132)
at com.intellij.codeInsight.completion.CompletionData.findPrefixStatic(CompletionData.java:146)
at com.intellij.codeInsight.completion.CompletionData.findPrefixStatic(CompletionData.java:161)
at com.intellij.codeInsight.completion.BaseCompletionService.suggestPrefix(BaseCompletionService.java:64)
at com.intellij.codeInsight.completion.CompletionService.performCompletion(CompletionService.java:132)
at com.intellij.codeInsight.completion.BaseCompletionService.performCompletion(BaseCompletionService.java:41)
at com.intellij.codeInsight.completion.CompletionProgressIndicator.lambda$calculateItems$12(CompletionProgressIndicator.java:863)
at com.intellij.util.indexing.FileBasedIndex.lambda$ignoreDumbMode$0(FileBasedIndex.java:163)
at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:111)
at com.intellij.util.indexing.FileBasedIndexEx.ignoreDumbMode(FileBasedIndexEx.java:574)
at com.intellij.util.indexing.FileBasedIndex.ignoreDumbMode(FileBasedIndex.java:162)
at com.intellij.util.indexing.DumbModeAccessType.ignoreDumbMode(DumbModeAccessType.java:43)
at com.intellij.codeInsight.completion.CompletionProgressIndicator.calculateItems(CompletionProgressIndicator.java:859)
at com.intellij.codeInsight.completion.CompletionProgressIndicator.runContributors(CompletionProgressIndicator.java:847)
at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$startContributorThread$6(CodeCompletionHandlerBase.java:353)
at com.intellij.codeInsight.completion.AsyncCompletion.lambda$tryReadOrCancel$5(CompletionThreading.java:172)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1096)
at com.intellij.codeInsight.completion.AsyncCompletion.tryReadOrCancel(CompletionThreading.java:170)
at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$startContributorThread$7(CodeCompletionHandlerBase.java:345)
at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$0(CompletionThreading.java:95)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:178)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:688)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:634)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:64)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:165)
at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$1(CompletionThreading.java:91)
at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)
at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)
at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:265)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:829)

@lte2000
Copy link
Owner

lte2000 commented Mar 9, 2022

The statement trigger the exception is:
VirtualFile workingDir = originalElement.getContainingFile().getVirtualFile().getParent();
I suspect originalElement.getContainingFile().getVirtualFile() return null, but can't image under which condition it will return null.

@stavstrom
Do the issue always happen even after restart Pycharm? If so, I can build a patch for you.

@stavstrom
Copy link
Author

I can't find any reliable way of recreating this behavior. But yes, I've seen it many times, even after restarting PyCharm.

@lte2000
Copy link
Owner

lte2000 commented Mar 9, 2022

@stavstrom
Please try the attached patch 0.12.191.8026.1.
intellibot.zip

@stavstrom
Copy link
Author

Thank you :-) We're a few test developers at a Swedish company that are very thankful for your contribution to this plugin

@stavstrom
Copy link
Author

Btw, the patch seem to work. I haven't seen this exception for a long time.

@lte2000
Copy link
Owner

lte2000 commented Mar 22, 2022

@stavstrom Thanks for the feedback. I will merge the code into main branch later.

lte2000 added a commit that referenced this issue Jun 2, 2022
@KotlinIsland
Copy link

KotlinIsland commented Jun 3, 2022

@stavstrom @ite2000 If this resolves the problem, this issue could be closed as completed.

@stavstrom
Copy link
Author

It does solve the problem, so you can close this ticket. Good work and thank you. :-)

@lte2000 lte2000 closed this as completed Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants