NullPointerException case

GWT Designer allows you to quickly create the modules, composites, panels, remote services and other elements that comprise Google Web Tookit applications.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

NullPointerException case

Postby ashouric » Sat Sep 30, 2006 9:39 pm

Dear all,

The following test case gives a NPE, it is extracted from a realtime working version.

Code: Select all
public class Test extends Composite implements ClickListener {

   private FlexTable mainTable;
   private Label priorityL;

   public Test() {

      final DockPanel dockPanel = new DockPanel();
      initWidget(dockPanel);

      mainTable = new FlexTable();

      priorityL = new Label("Priority");
      mainTable.setWidget(0, 0, priorityL);

      final VerticalPanel verticalPanel = new VerticalPanel();
      verticalPanel.add( mainTable );
      dockPanel.add(verticalPanel, DockPanel.CENTER);
   }

   public void onClick(Widget sender) {
      int row = mainTable.getRowCount();
      mainTable.insertRow( row );
      mainTable.setWidget( row, 0, new Label() );
   }


}
ashouric
 
Posts: 75
Joined: Sat Sep 30, 2006 9:13 pm

Re: NullPointerException case

Postby Eric Clayberg » Sun Oct 01, 2006 3:40 pm

Use a code hiding tag to hide the following line...

Code: Select all
mainTable.setWidget(row, 0, new Label()); //$hide$
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: NullPointerException case

Postby Eric Clayberg » Mon Oct 02, 2006 5:20 pm

In the latest build, Designer should be able to parse the original example code without any mods.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Postby ashouric » Mon Oct 02, 2006 9:18 pm

That's great, although hiding is a valid solution, this tolerates the annoying Exception.

Many thanks.
ashouric
 
Posts: 75
Joined: Sat Sep 30, 2006 9:13 pm


Return to GWT Designer

Who is online

Users browsing this forum: No registered users and 3 guests