NPE during PlatformTestCase execution: components.impl.ComponentManagerImpl$ComponentsRegistry.access$300(ComponentManagerImpl.java:452)

I am getting the following NPE during execution of one our tests based on PlatformTestCase.
Any idea on how to fix this?

I am using Idea community edition 10, with OpenJDK.

Thanks,
Chandra

java.lang.NullPointerException
    at com.intellij.openapi.

components.impl.ComponentManagerImpl$ComponentsRegistry.access$300(ComponentManagerImpl.java:452)
     at com.intellij.openapi.components.impl.ComponentManagerImpl.getComponentFromContainer(ComponentManagerImpl.java:183)
    at com.intellij.openapi.components.impl.ComponentManagerImpl.getComponent(ComponentManagerImpl.java:219)
     at com.intellij.openapi.components.impl.ComponentManagerImpl.getComponent(ComponentManagerImpl.java:215)
    at com.intellij.openapi.command.undo.UndoManager.getInstance(UndoManager.java:29)
    at com.intellij.testFramework.PlatformTestCase.cleanupApplicationCaches(PlatformTestCase.java:289)
     at com.intellij.testFramework.PlatformTestCase$4.run(PlatformTestCase.java:483)
    at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:161)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:332)
     at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)

java.lang.NullPointerException
    at com.intellij.ide.wizard.AbstractWizard.initWizard(AbstractWizard.java:86)
     at com.intellij.ide.wizard.AbstractWizard.<init>(AbstractWizard.java:65)
    at com.google.devtools.intellig.blazeplugin.NewBlazeProjectWizard.<init>(NewBlazeProjectWizard.java:60)
    at com.google.devtools.intellig.blazeplugin.NewBlazeProjectWizard$Factory.makeWizard(NewBlazeProjectWizard.java:297)
     at com.google.devtools.intellig.blazeplugin.NewBlazeProjectWizardTest.setUp(NewBlazeProjectWizardTest.java:110)
    at com.intellij.testFramework.PlatformTestCase$5.run(PlatformTestCase.java:503)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:216)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)

ERROR: null
java.lang.NullPointerException
    at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentsRegistry.access$300(ComponentManagerImpl.java:452)
     at com.intellij.openapi.components.impl.ComponentManagerImpl.getComponentFromContainer(ComponentManagerImpl.java:183)
    at com.intellij.openapi.components.impl.ComponentManagerImpl.getComponent(ComponentManagerImpl.java:219)
     at com.intellij.openapi.components.impl.ComponentManagerImpl.getComponent(ComponentManagerImpl.java:215)
    at com.intellij.openapi.command.undo.UndoManager.getInstance(UndoManager.java:29)
    at com.intellij.testFramework.PlatformTestCase.cleanupApplicationCaches(PlatformTestCase.java:289)
     at com.intellij.testFramework.PlatformTestCase$4.run(PlatformTestCase.java:483)
    at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:161)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:332)
     at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
Exception in thread "AWT-EventQueue-0 10.0.3#IC-103.255, eap:false 10.0.3#IC-103.255, eap:false" java.lang.AssertionError: null
     at com.intellij.testFramework.LoggedErrorProcessor$1.processError(LoggedErrorProcessor.java:35)
    at com.intellij.testFramework.TestLogger.error(TestLogger.java:51)
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:63)
     at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:342)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
- START INDEX SHUTDOWN
- END INDEX SHUTDOWN
- Purging local history...
- Local history storage successfully closed.
- VFS dispose started
- VFS dispose completed
***********************************************************************************************
***                        M E M O R Y    L E A K S   D E T E C T E D                       ***
***********************************************************************************************
***                                                                                         ***
***   The following objects were not disposed:
***   com.google.devtools.intellig.blazeplugin.NewBlazeProjectWizard@1c21535 of class class com.intellij.openapi.ui.DialogWrapper$1
***         First seen at:
java.lang.Throwable
     at com.intellij.openapi.util.objectTree.ObjectNode.<init>(ObjectNode.java:49)
    at com.intellij.openapi.util.objectTree.ObjectTree.getOrCreateNodeFor(ObjectTree.java:110)
    at com.intellij.openapi.util.objectTree.ObjectTree.register(ObjectTree.java:76)
     at com.intellij.openapi.util.Disposer.register(Disposer.java:69)
    at com.intellij.openapi.util.Disposer.register(Disposer.java:63)
    at com.intellij.util.Alarm.<init>(Alarm.java:90)
    at com.intellij.util.Alarm.<init>(Alarm.java:78)
     at com.intellij.openapi.ui.DialogWrapper.<init>(DialogWrapper.java:198)
    at com.intellij.ide.wizard.AbstractWizard.<init>(AbstractWizard.java:63)
    at com.google.devtools.intellig.blazeplugin.NewBlazeProjectWizard.<init>(NewBlazeProjectWizard.java:60)
     at com.google.devtools.intellig.blazeplugin.NewBlazeProjectWizard$Factory.makeWizard(NewBlazeProjectWizard.java:297)
    at com.google.devtools.intellig.blazeplugin.NewBlazeProjectWizardTest.setUp(NewBlazeProjectWizardTest.java:110)
     at com.intellij.testFramework.PlatformTestCase$5.run(PlatformTestCase.java:503)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:216)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
***                                                                                         ***
***********************************************************************************************

Process finished with exit code 255
3 comments
Comment actions Permalink

Hello chandra,

Are you trying to run your tests in headless mode? The problem happens because
the AbstractWizard initialization fails on getting JDialog.getRootPane().

I am getting the following NPE during execution of one our tests based
on PlatformTestCase. Any idea on how to fix this?

I am using Idea community edition 10, with OpenJDK.

Thanks,
Chandra
java.lang.NullPointerException
at com.intellij.openapi.
components.impl.ComponentManagerImpl$ComponentsRegistry.access$300(Com
ponentManagerImpl.java:452)
at
com.intellij.openapi.components.impl.ComponentManagerImpl.getComponent
FromContainer(ComponentManagerImpl.java:183)
at
com.intellij.openapi.components.impl.ComponentManagerImpl.getComponent
(ComponentManagerImpl.java:219)
at
com.intellij.openapi.components.impl.ComponentManagerImpl.getComponent
(ComponentManagerImpl.java:215)
at
com.intellij.openapi.command.undo.UndoManager.getInstance(UndoManager.
java:29)
at
com.intellij.testFramework.PlatformTestCase.cleanupApplicationCaches(P
latformTestCase.java:289)
at
com.intellij.testFramework.PlatformTestCase$4.run(PlatformTestCase.jav
a:483)
at
com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvoca
tor.java:161)
at
com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(La
terInvocator.java:332)
at
java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThrea
d.java:275)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.j
ava:200)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThrea
d.java:190)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
java.lang.NullPointerException
at
com.intellij.ide.wizard.AbstractWizard.initWizard(AbstractWizard.java:
86)
at
com.intellij.ide.wizard.AbstractWizard.<init>(AbstractWizard.java:65)
at
com.google.devtools.intellig.blazeplugin.NewBlazeProjectWizard.<init>(
NewBlazeProjectWizard.java:60)
at
com.google.devtools.intellig.blazeplugin.NewBlazeProjectWizard$Factory
.makeWizard(NewBlazeProjectWizard.java:297)
at
com.google.devtools.intellig.blazeplugin.NewBlazeProjectWizardTest.set
Up(NewBlazeProjectWizardTest.java:110)
at
com.intellij.testFramework.PlatformTestCase$5.run(PlatformTestCase.jav
a:503)
at
java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:216)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThrea
d.java:275)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.j
ava:200)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThrea
d.java:190)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
ERROR: null
java.lang.NullPointerException
at
com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentsRe
gistry.access$300(ComponentManagerImpl.java:452)
at
com.intellij.openapi.components.impl.ComponentManagerImpl.getComponent
FromContainer(ComponentManagerImpl.java:183)
at
com.intellij.openapi.components.impl.ComponentManagerImpl.getComponent
(ComponentManagerImpl.java:219)
at
com.intellij.openapi.components.impl.ComponentManagerImpl.getComponent
(ComponentManagerImpl.java:215)
at
com.intellij.openapi.command.undo.UndoManager.getInstance(UndoManager.
java:29)
at
com.intellij.testFramework.PlatformTestCase.cleanupApplicationCaches(P
latformTestCase.java:289)
at
com.intellij.testFramework.PlatformTestCase$4.run(PlatformTestCase.jav
a:483)
at
com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvoca
tor.java:161)
at
com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(La
terInvocator.java:332)
at
java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThrea
d.java:275)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.j
ava:200)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThrea
d.java:190)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
Exception in thread "AWT-EventQueue-0 10.0.3#IC-103.255, eap:false
10.0.3#IC-103.255, eap:false" java.lang.AssertionError: null
at
com.intellij.testFramework.LoggedErrorProcessor$1.processError(LoggedE
rrorProcessor.java:35)
at com.intellij.testFramework.TestLogger.error(TestLogger.java:51)
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:63)
at
com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(La
terInvocator.java:342)
at
java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThrea
d.java:275)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.j
ava:200)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThrea
d.java:190)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
- START INDEX SHUTDOWN
- END INDEX SHUTDOWN
- Purging local history...
- Local history storage successfully closed.
- VFS dispose started
- VFS dispose completed
**********************************************************************
*************************

      •                        M E M O R Y    L E A K S   D E T E C T E D

***
**********************************************************************
*************************
***
***

      •   The following objects were not disposed:

***
com.google.devtools.intellig.blazeplugin.NewBlazeProjectWizard@1c21535
of class class com.intellij.openapi.ui.DialogWrapper$1

      •         First seen at:

java.lang.Throwable
at
com.intellij.openapi.util.objectTree.ObjectNode.<init>(ObjectNode.java
:49)
at
com.intellij.openapi.util.objectTree.ObjectTree.getOrCreateNodeFor(Obj
ectTree.java:110)
at
com.intellij.openapi.util.objectTree.ObjectTree.register(ObjectTree.ja
va:76)
at com.intellij.openapi.util.Disposer.register(Disposer.java:69)
at com.intellij.openapi.util.Disposer.register(Disposer.java:63)
at com.intellij.util.Alarm.<init>(Alarm.java:90)
at com.intellij.util.Alarm.<init>(Alarm.java:78)
at
com.intellij.openapi.ui.DialogWrapper.<init>(DialogWrapper.java:198)
at
com.intellij.ide.wizard.AbstractWizard.<init>(AbstractWizard.java:63)
at
com.google.devtools.intellig.blazeplugin.NewBlazeProjectWizard.<init>(
NewBlazeProjectWizard.java:60)
at
com.google.devtools.intellig.blazeplugin.NewBlazeProjectWizard$Factory
.makeWizard(NewBlazeProjectWizard.java:297)
at
com.google.devtools.intellig.blazeplugin.NewBlazeProjectWizardTest.set
Up(NewBlazeProjectWizardTest.java:110)
at
com.intellij.testFramework.PlatformTestCase$5.run(PlatformTestCase.jav
a:503)
at
java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:216)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThrea
d.java:275)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.j
ava:200)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThrea
d.java:190)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
***
***
**********************************************************************
*************************Process finished with exit code 255
---
Original message URL:
http://devnet.jetbrains.net/message/5302853#5302853


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

I think it is not headless mode. [while running /debugging test I can see a Java window related icon on desktop status bar]

I am creating a Window as given below:
    dummyWindow = new Frame();
    dummyWindow.setExtendedState(Frame.ICONIFIED);
    dummyWindow.setFocusableWindowState(false); // try to stop the test from stealing focus
    dummyWindow.setVisible(true);

Later passing this window to AbstractWizard().

Is this usage correct?

0
Comment actions Permalink

com.intellij.openapi.ui.impl.DialogWrapperPeerImpl has the following code which creates dialog:

private void createDialog(Window owner, boolean canBeParent) {
    if (isHeadless()) {
      myDialog = new HeadlessDialog();
      return;
    }

    if (owner instanceof Frame) {
      myDialog = new MyDialog((Frame)owner, myWrapper, myProject, myWindowFocusedCallback, myTypeAheadDone);
    }
    else {
      myDialog = new MyDialog((Dialog)owner, myWrapper, myProject, myWindowFocusedCallback, myTypeAheadDone);
    }
    myDialog.setModal(true);
    myCanBeParent = canBeParent;
  }

isHeadLess() is returning true [return app.isUnitTestMode() || app.isHeadlessEnvironment();] as a) unit test mode and b) app.myHeadlessMode both are true.

thus createDialog() is instantiating HeadlessDailog. HeadlessDailog.getRootPane() is returning null. This is resulting in NPE.

While debugging, I override value of myDialog to "new MyDialog((Frame)owner, myWrapper, myProject, myWindowFocusedCallback, myTypeAheadDone);" then the test started passing as earlier.

Is there way to instruct DialogWrapperPeerImpl not to return HeadlessDialog() for this scenario?               

Here is relevant code in Idea 9.0.4

private void createDialog(Window owner, boolean canBeParent) {
    if (owner instanceof Frame) {
      myDialog = new MyDialog((Frame)owner, myWrapper, myProject, myWindowFocusedCallback, myTypeAheadDone);
    }
    else {
      myDialog = new MyDialog((Dialog)owner, myWrapper, myProject, myWindowFocusedCallback, myTypeAheadDone);
    }
    myDialog.setModal(true);
    myCanBeParent = canBeParent;

  }

As you can see, there are no 'headless' related checks in 9.0.4 code.

0

Please sign in to leave a comment.