View Full Version : [FIXED] NullPointerException when collapsing a BorderLayoutContainer

21 Feb 2012, 9:43 AM
I am on GWT 3 beta 3.

I created a BorderLayoutContainer with collapsible panel on the west side. Here is the code snippet

westPanel = new ContentPanel();
centerPanel = new ContentPanel();

final BorderLayoutContainer container = new BorderLayoutContainer();

//add west
final BorderLayoutData westData = new BorderLayoutData(200);
container.setWestWidget(westPanel, westData);

//add center
final BorderLayoutData centerData = new BorderLayoutData();
container.setCenterWidget(centerPanel, centerData);


When i try to collapse the west panel, i get the following exception :

Caused by: java.lang.NullPointerException: null
at com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.createCollapsePanel(BorderLayoutContainer.java:538)
at com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.onCollapse(BorderLayoutContainer.java:743)
at com.sencha.gxt.widget.core.client.container.BorderLayoutContainer$Handler.onBeforeCollapse(BorderLayoutContainer.java:275)
at com.sencha.gxt.widget.core.client.event.BeforeCollapseEvent.dispatch(BeforeCollapseEvent.java:88)
at com.sencha.gxt.widget.core.client.event.BeforeCollapseEvent.dispatch(BeforeCollapseEvent.java:1)
at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)

When i look at the blamed code, i see the following (BorderLayoutContainer.java, line 537-538)

Margins m = data.getMargins();
collapseData.setMargins(new Margins(m.getTop(), m.getRight(), m.getBottom(), m.getLeft()));

The margin is indeed null on my borderlayoutdata (the westData) since i provided none during the construction because i used the construction with the single "size" argument, which does not initialize the margin field.

Thanks for your fix on this.


23 Feb 2012, 5:19 PM
Thanks for bringing this to our attention. I've filed a bug against the team, and I'll update this thread with any progress we make.

11 Mar 2012, 6:53 PM
Fixed in SVN (rev 2315).

28 Mar 2012, 4:16 PM
This bug has been fixed in the Ext GWT 3.0 Release Candidate. Please upgrade your copy of Ext GWT and try your test case again. While we're confident that we've addressed this issue, please reply if you notice any continued problems after upgrading. Again, thanks for taking the time to report this bug.