Saturday, August 30, 2014

Re: GWT using SDM throws error at app startup

Hum...I'm not entirely clear how that maps to the java code.  As I follow that stack trace I think this comes down to this code:

public class LoadAdsPrepareGridPresenter {

    private final ILoadAdsPrepareGridModel model;
    private final ILoadAdsPrepareGridView view;

    public LoadAdsPrepareGridPresenter(final ILoadAdsPrepareGridModel model,
                                       final ILoadAdsPrepareGridView view) {
        this.model = model;
        this.view = view;

        model.addListener(new ILoadAdsPrepareGridModelListener() {
            @Override
            public void gridRowsChanged() {
                view.setBookingSheetRowData(
                        model.getGridBookingSheetRowModels());
            }
        });

So are you saying that the member variable 'view' is null?  This is injected into the class so it's not possible for it to be null...and it's final.

Or are you saying that view is not null but it's somehow calling getView()?  I don't think this is the case but I wanted to be sure.  (In my java code the view doesn't have any method called 'getView()' I'm assuming 'getView()' is something generated by GWT to get the view variable.).

-Dave



On Sat, Aug 30, 2014 at 12:58 PM, Jens <jens.nehlmeier@gmail.com> wrote:
GWT often (if not always) transforms methods that are not overridden into static methods. Such static methods begin with a $ sign.

In your stack trace you can see Unknown.$getView is causing the exception with message "Can not read property 'view' of undefined". That basically means in your Java code you have called null.getView() because GWT transforms this into something like $getView(instance) { return instance.view; } with instance being "undefined" (= null).

So it is either a bug in your app which can cause NullPointer exceptions or you have found a very rare case which causes the GWT compiler to produce wrong JS. 

-- J.

--
You received this message because you are subscribed to a topic in the Google Groups "Google Web Toolkit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/1lsSTQluIxE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment