Menu

#12 NPE in GridControl

jWic_Base
open
nobody
None
1
2014-03-07
2014-03-07
No

Instantiating a simple class derived from GridControl causes a NullPointerException (NPE):

java.lang.NullPointerException
at de.jwic.controls.grid.GridControl.init(GridControl.java:262)
at de.jwic.controls.grid.GridControl.<init>(GridControl.java:112)
at de.pol.jwic.persist.datagrid.profiles.LightColSetupGrid.<init>(LightColSetupGrid.java:38)
at de.pol.jwic.persist.datagrid.profiles.LightColSetupGridTest.testLightColSetupGrid(LightColSetupGridTest.java:27)
    ...

This is the constructor of the class:

public LightColSetupGrid(IControlContainer container, String name) {
    super(container, name);
}

As you can see it calls only the constructor of the superclass (GridControl). This is the test which causes the NPE:

@Test
public void testLightColSetupGrid() {
    IControlContainer container = new ControlContainerMock();
    LightColSetupGrid grid = new LightColSetupGrid(container, "TEST");
    assertNotNull(grid);
}

The GridControl is called with two valid arguments (you can find the used ControlContainerMock in the attachment). So the NPE should not happen here because the given arguments are not null.

1 Attachments

Discussion


Log in to post a comment.

MongoDB Logo MongoDB