mjedynak/Builder-Generator — Issue #2: NPE when trying to generate builder for class that is not in the project module
Author: mjedynak
Created: 2012-01-21 20:11:06+00:00
State: open

For classes added as dependency to the project (not in the projects sources), NPE is thrown during builder generation:

Error during dispatching of java.awt.event.MouseEvent[MOUSE_RELEASED,(220,124),absolute(648,446),button=1,modifiers=Button1,clickCount=1] on dialog0
java.lang.NullPointerException
at com.intellij.ide.util.PackageUtil.findPossiblePackageDirectoryInModule(PackageUtil.java:56)
at pl.mjedynak.idea.plugins.builder.psi.impl.PsiHelperImpl.getDirectoryFromModuleAndPackageName(PsiHelperImpl.java:51)
at pl.mjedynak.idea.plugins.builder.gui.OKActionRunnable.run(OKActionRunnable.java:36)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:112)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:88)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:76)
at pl.mjedynak.idea.plugins.builder.gui.CreateBuilderDialog.doOKAction(CreateBuilderDialog.java:142)
at com.intellij.openapi.ui.DialogWrapper$OkAction.doAction(DialogWrapper.java:1478)
at com.intellij.openapi.ui.DialogWrapper$DialogWrapperAction.actionPerformed(DialogWrapper.java:1449)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6288)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6053)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4651)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:643)
at java.awt.EventQueue.access$000(EventQueue.java:84)
at java.awt.EventQueue$1.run(EventQueue.java:602)
at java.awt.EventQueue$1.run(EventQueue.java:600)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:616)
at java.awt.EventQueue$2.run(EventQueue.java:614)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:613)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:694)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:530)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:416)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:374)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
at java.awt.Dialog$1.run(Dialog.java:1046)
at java.awt.Dialog$3.run(Dialog.java:1098)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:1096)
at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:709)
at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:416)
at com.intellij.openapi.ui.DialogWrapper.showAndGetOk(DialogWrapper.java:1323)
at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1308)
at pl.mjedynak.idea.plugins.builder.gui.CreateBuilderDialog.show(CreateBuilderDialog.java:66)
at pl.mjedynak.idea.plugins.builder.action.handler.DisplayChoosersRunnable.showDialog(DisplayChoosersRunnable.java:86)
at pl.mjedynak.idea.plugins.builder.action.handler.DisplayChoosersRunnable.run(DisplayChoosersRunnable.java:60)
at com.intellij.ui.popup.AbstractPopup$16.run(AbstractPopup.java:1134)
at com.intellij.openapi.wm.impl.FocusManagerImpl.flushRequest(FocusManagerImpl.java:611)
at com.intellij.openapi.wm.impl.FocusManagerImpl.flushNow(FocusManagerImpl.java:592)
at com.intellij.openapi.wm.impl.FocusManagerImpl.flushIdleRequests(FocusManagerImpl.java:562)
at com.intellij.openapi.wm.impl.FocusManagerImpl.access$200(FocusManagerImpl.java:52)
at com.intellij.openapi.wm.impl.FocusManagerImpl$7.run(FocusManagerImpl.java:461)
at com.intellij.util.ui.UIUtil.invokeLaterIfNeeded(UIUtil.java:1699)
at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:439)
at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl.updateActions(ActionToolbarImpl.java:853)
at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl.access$400(ActionToolbarImpl.java:56)
at com.intellij.openapi.actionSystem.impl.ActionToolbarImpl$MyTimerListener.run(ActionToolbarImpl.java:765)
at com.intellij.openapi.actionSystem.impl.WeakTimerListener.run(WeakTimerListener.java:50)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$MyTimer.runListenerAction(ActionManagerImpl.java:1254)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$MyTimer.notifyListeners(ActionManagerImpl.java:1243)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$MyTimer.actionPerformed(ActionManagerImpl.java:1224)
at javax.swing.Timer.fireActionPerformed(Timer.java:291)
at javax.swing.Timer$DoPostEvent.run(Timer.java:221)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:641)
at java.awt.EventQueue.access$000(EventQueue.java:84)
at java.awt.EventQueue$1.run(EventQueue.java:602)
at java.awt.EventQueue$1.run(EventQueue.java:600)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:611)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:694)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:534)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:416)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:374)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)