krasa / GrepConsole

IntelliJ plugin - https://plugins.jetbrains.com/plugin/7125
Apache License 2.0
436 stars 57 forks source link

Please Fix NPE #164

Closed reid-spencer closed 4 years ago

reid-spencer commented 4 years ago

Describe the bug This happens during IDEA startup. java.lang.NullPointerException at krasa.grepconsole.integration.MyConsoleFilterProvider.getDefaultFilters(MyConsoleFilterProvider.java:22) at com.intellij.execution.impl.ConsoleViewUtil.computeConsoleFilters(ConsoleViewUtil.java:252) at com.intellij.execution.impl.ConsoleViewImpl.(ConsoleViewImpl.java:173) at com.intellij.execution.impl.ConsoleViewImpl.(ConsoleViewImpl.java:150) at com.intellij.execution.filters.TextConsoleBuilderImpl.createConsole(TextConsoleBuilderImpl.java:58) at com.intellij.execution.filters.TextConsoleBuilderImpl.getConsole(TextConsoleBuilderImpl.java:49) at com.intellij.openapi.externalSystem.service.execution.DefaultExternalSystemExecutionConsoleManager.attachExecutionConsole(DefaultExternalSystemExecutionConsoleManager.java:52) at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.executeImpl(ExternalSystemUtil.java:442) at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.lambda$execute$1(ExternalSystemUtil.java:392) at com.intellij.openapi.project.DumbServiceImpl.suspendIndexingAndRun(DumbServiceImpl.java:150) at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(ExternalSystemUtil.java:392) at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$4.run(ExternalSystemUtil.java:638) at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:888) at com.intellij.openapi.progress.impl.CoreProgressManager$5.run(CoreProgressManager.java:441) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:163) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:585) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:531) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:150) at com.intellij.openapi.application.impl.ApplicationImpl.lambda$null$4(ApplicationImpl.java:441) at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:221) at com.intellij.util.ConcurrencyUtil.lambda$underThreadNameRunnable$3(ConcurrencyUtil.java:209) at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:238) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) 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.lang.Thread.run(Thread.java:834)

To Reproduce Steps to reproduce the behavior:

  1. Start IntelliJ IDEA
  2. Open a Project

Expected behavior A clear and concise description of what you expected to happen.

Screenshots The NPE doesn't happen

Environment : IntelliJ IDEA 2019.3.2 (Ultimate Edition) Build #IU-193.6015.39, built on January 20, 2020 Licensed to Reid Spencer Subscription is active until November 22, 2020 Runtime version: 11.0.5+10-b520.30 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.15.3 GC: ParNew, ConcurrentMarkSweep Memory: 1979M Cores: 12 Registry: ide.balloon.shadow.size=0, tabs.alphabetical=true Non-Bundled Plugins: BashSupport, CheckStyle-IDEA, FindBugs-IDEA, GrepConsole, IvyIDEA, Lombook Plugin, PsiViewer, org.jetbrains.plugins.rest, Pythonid, String Manipulation, VisualVMLauncher, com.alayouni.ansiHighlight, com.codestream.jetbrains-codestream, com.intellij.ideolog, com.intellij.kubernetes, com.intellij.plugins.html.instantEditing, com.jetbrains.ChooseRuntime, com.jetbrains.plugins.ini4idea, com.jetbrains.upsource, io.protostuff.protostuff-jetbrains-plugin, org.intellij.RegexpTester, org.intellij.scala, org.jetbrains.plugins.go, org.jetbrains.plugins.hocon, org.scalafmt.ScalaFmt, training

Additional context

alt-grr commented 4 years ago

@krasa It happens for example when a new scala project (that uses sbt) is opened and Run window is opened with 'sbt sync' command. Project window is still mostly empty during this time, so maybe there's no project object created yet?

krasa commented 4 years ago

Try this https://github.com/krasa/GrepConsole/releases/download/9.9.162.000.0/GrepConsole.zip

alt-grr commented 4 years ago

Thanks :) I just tried to help you understand the underlying issue more, because maybe the real bug is in GrepProjectComponent.getInstance(project) returning null at all, or even somewhere deeper. It's better to identify the root cause of "this should never be null".

krasa commented 4 years ago

Yes, thanks. @NotNull Project project would throw an exception if the project was null, so GrepProjectComponent is probably not created yet, which is strange.