Thanks so much for the detailed response. And I'll give those dev tool suggestions a try.
And what you say makes sense about dereferencing a null, but it doesn't explain how it would work most of the time, but sometimes it doesn't. If the code is dereferencing null it should always be an error, right?
Anyway, thanks again, you've given me some things to try.
On Sat, Jan 17, 2015 at 4:46 AM, Jens <jens.nehlmeier@gmail.com> wrote:
You can test it locally if you use Chrome DevTools. When you open DevTools you can click on the small mobile device icon on the left side right next to the search icon. Once you have done that you should see a new dark toolbar at the top of your page which has a Network drop down which allows you to emulate slower network conditions in Chrome.Given your stack trace it seems like you called AbsolutePanel.add(childWidget) somewhere but your instance of AbsolutePanel was null.For your understanding how to read these stack frames:__gwt$exception: <skipped>: Cannot read property 'com_google_gwt_user_client_ui_UIObject_element' of null
at Unknown.com_google_gwt_user_client_ui_AbsolutePanel_$add__Lcom_google_gwt_user_client_ui_AbsolutePanel_2Lcom_google_gwt_user_client_ui_Widget_2VFirst line is the JavaScript exception message which says you have tried to access UIObject.element but UIObject was null. Since UIObject has a getElement() method that means your java code did call "null.getElement()". At the next line you see that this happened in AbsolutePanel.$add(AbsolutePanel, Widget). This method has been generated by the GWT compiler and is a static version of AbsolutePanel.add(Widget). These generated static methods are marked with "$" by GWT. Given the implementation of AbsolutePanel.add(Widget) it seems like your instance of AbsolutePanel was null.Your code did something like:AbsolutePanel myPanel = null; // somehow the variable was nullmyPanel.add(child);with AbsolutePanel.add() being implemented as:public void add(Widget w) {super.add(w, getElement());}GWT compiler changed your method call to a static method callAbsolutePanel.$add(myPanel, w);And the implementation of $add is probably similar topublic static void $add(AbsolutePanel instance, Widget w) {ComplexPanel.$add(w, instance.getElement());}The bold code causes the exception. Since getElement() and the element field are defined on UiObject the exception message says you have tried to access UiObject.element with UiObject being null.-- 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/PFyayaTVYbA/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