NullPointerException when Showing DialogWrapper during Gradle buildSearchableOptions
Answered
I am getting a NullPointerException when trying to build my plugin during the gradle task buildSearchableOptions. The line causing it is the .show() call. Below is my main method and my very simple DialogWrapper classes. What am I doing wrong?
ErrorDialog errorDialog = new ErrorDialog(project);errorDialog.show();
public class ErrorDialog extends DialogWrapper {
private JPanel mainPanel;
private JTextArea messageArea;
private JLabel descriptionLabel;
public SettingsErrorDialog(@Nullable Project project) {
super(project);
setTitle(title);
init();
}
@Nullable
@Override
protected JComponent createCenterPanel() {
return this.popupMainPanel;
}
}
Please sign in to leave a comment.
Here is the full NullPointerException that I get even when I use the sample DialogWrapper class from: https://www.jetbrains.org/intellij/sdk/docs/user_interface_components/dialog_wrapper.html
I have surrounded the .show() line with a try catch which solves the problem, but this doesn't seem quite right.
Please link your full sources
I'm having the same problem, NPE in buildSearchableOptions, when I use ideaVersion = IC-2019.2 in my gradle.properties. Downgrading to IC-2018.3.5 solves the problem. All I did was I added the code style settings provider to my language plugin and just to get started I just copy&paste the code from Json plugin. Here's the relevant piece of code:
And the stack trace is:
Searchable options index builder failed
java.lang.NullPointerException
at com.intellij.application.options.CodeStyleAbstractPanel.installPreviewPanel(CodeStyleAbstractPanel.java:437)
at com.intellij.application.options.codeStyle.OptionTreeWithPreviewPanel.init(OptionTreeWithPreviewPanel.java:79)
at com.intellij.application.options.codeStyle.CodeStyleSpacesPanel.<init>(CodeStyleSpacesPanel.java:29)
at com.intellij.application.options.TabbedLanguageCodeStylePanel$MySpacesPanel.<init>(TabbedLanguageCodeStylePanel.java:360)
at com.intellij.application.options.TabbedLanguageCodeStylePanel.addSpacesTab(TabbedLanguageCodeStylePanel.java:95)
at com.foo.bar.language.formatter.SimpleCodeStyleSettingsProvider$1$1.initTabs(SimpleCodeStyleSettingsProvider.java:29)
at com.intellij.application.options.TabbedLanguageCodeStylePanel.ensureTabs(TabbedLanguageCodeStylePanel.java:121)
at com.intellij.application.options.TabbedLanguageCodeStylePanel.getPreviewText(TabbedLanguageCodeStylePanel.java:199)
at com.intellij.application.options.CodeStyleAbstractPanel.createEditor(CodeStyleAbstractPanel.java:138)
at com.intellij.application.options.CodeStyleAbstractPanel.<init>(CodeStyleAbstractPanel.java:97)
at com.intellij.application.options.TabbedLanguageCodeStylePanel.<init>(TabbedLanguageCodeStylePanel.java:54)
at com.foo.bar.language.formatter.SimpleCodeStyleSettingsProvider$1$1.<init>(SimpleCodeStyleSettingsProvider.java:25)
at com.foo.bar.language.formatter.SimpleCodeStyleSettingsProvider$1.createPanel(SimpleCodeStyleSettingsProvider.java:25)
at com.intellij.application.options.CodeStyleAbstractConfigurable.createComponent(CodeStyleAbstractConfigurable.java:34)
at com.intellij.application.options.codeStyle.NewCodeStyleSettingsPanel.<init>(NewCodeStyleSettingsPanel.java:35)
at com.intellij.ConfigurableFactory$createCodeStyleConfigurable$codeStyleConfigurableWrapper$1.createPanel(ConfigurableFactory.kt:46)
at com.intellij.application.options.codeStyle.CodeStyleMainPanel.ensurePanel(CodeStyleMainPanel.java:238)
at com.intellij.application.options.codeStyle.CodeStyleMainPanel.ensureCurrentPanel(CodeStyleMainPanel.java:223)
at com.intellij.application.options.codeStyle.CodeStyleMainPanel.lambda$onCurrentSchemeChanged$0(CodeStyleMainPanel.java:163)
at com.intellij.application.options.codeStyle.CodeStyleMainPanel.onCurrentSchemeChanged(CodeStyleMainPanel.java:170)
at com.intellij.application.options.codeStyle.CodeStyleMainPanel.<init>(CodeStyleMainPanel.java:134)
at com.intellij.application.options.CodeStyleConfigurableWrapper.createComponent(CodeStyleConfigurableWrapper.java:48)
at com.intellij.ide.ui.search.SearchUtil.processConfigurables(SearchUtil.java:76)
at com.intellij.ide.ui.search.SearchUtil.processProjectConfigurables(SearchUtil.java:48)
at com.intellij.ide.ui.search.TraverseUIStarter.startup(TraverseUIStarter.java:106)
at com.intellij.ide.ui.search.TraverseUIStarter.main(TraverseUIStarter.java:87)
at com.intellij.idea.IdeaApplication.lambda$null$3(IdeaApplication.java:154)
at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:192)
at com.intellij.idea.IdeaApplication.lambda$executeInitAppInEdt$5(IdeaApplication.java:154)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:433)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Eugene Berman, sorry for delay. I found similar sounding issues here https://github.com/JetBrains/gradle-intellij-plugin/issues/424 and maybe https://github.com/JetBrains/gradle-intellij-plugin/issues/437. Please make sure you use latest available version of gradle-intellij-plugin. If it still reproduces, please file issue and attach your build.gradle for reproducing, thanks.