Does anybody know how GWT map java constructors to java script? I see constructor in javascript as function with "this$static" parameter. When this$static var is initiated and how? In what conditions it can be null?
On Jul 16, 6:07 pm, Jaroslav Záruba <[email protected]> wrote: > I know, I went after the exception message and saw it comes from within GWT > code. > > > > On Fri, Jul 16, 2010 at 5:04 PM, evgenyk <[email protected]> wrote: > > I said from time to time because I do not know exactly user scenario. > > Maybe there is one which always causes an error. I have rather large > > application and I have uncaught exception handler which sends me error > > information. > > I deployed non obfuscated version on my production server and trying > > to understand by stack traces what is going on. > > Line where the exception occurs is always in sources of Label. And It > > seems that exception occurs only on FF 3.0.x. I have many clients with > > FF 3.3.x and do not see exceptions from them. > > And I have a com.google.gwt.user.client.Timer scheduled with rpc calls > > with changes in UI. But I can't understand how it affects Label > > creation, as exception is thrown when Label is not attached to DOM > > tree. > > Only Document.get().createDivElement() called and result is stored in > > Label. And the exception is thrown before the element is attached to > > DOM tree. > > > On Jul 16, 4:34 pm, Jaroslav Záruba <[email protected]> wrote: > > > It smells asynchronously to me when such "smetimes"-error occur. > > > Aren't there DOM changes being made when you're instantiating YourLabel? > > > > On Fri, Jul 16, 2010 at 3:28 PM, evgenyk <[email protected]> wrote: > > > > It works for me too. It fails on my clients' computers from time to > > > > time. If I could make a reproduce scenario I would submit a bug. > > > > I write here because I can't find a way to reproduce this error. > > > > > On Jul 16, 4:04 pm, Jaroslav Záruba <[email protected]> wrote: > > > > > I threw away the Formatter and ObjectControl references so that I > > could > > > > > compile it, and it works in Chrome and FF too. > > > > > > On Fri, Jul 16, 2010 at 2:49 PM, evgenyk <[email protected]> wrote: > > > > > > Just received an exception inside the following block: > > > > > > ---------------- > > > > > > function $Label(this$static, text){ > > > > > > $setElement(this$static, ($clinit_73() , > > > > > > $doc).createElement('div')); > > > > > > (!!this$static.element || throwAssertionError_Object("This > > > > > > UIObject's element is not set; you may be missing a call to either > > > > > > Composite.initWidget() or UIObject.setElement()") , this > > > > > > $static.element)['className'] = 'gwt-Label'; > > > > > > this$static.setText(text); > > > > > > return this$static; > > > > > > } > > > > > > ---------------- > > > > > > exception was thrown in 3rd line: (!!this$static.element ||.... > > > > > > This is plain GWT Label. It seems like a bug in GWT with Firefox > > > > > > 3.0.10 > > > > > > Unfortunately I can't reproduce it. Time after time it is thrown on > > my > > > > > > client workstations. It is caught using > > > > > > GWT.setUncaughtExceptionHandler. > > > > > > Any ideas? > > > > > > > On Jul 16, 3:23 pm, evgenyk <[email protected]> wrote: > > > > > > > public class MyLabel<T> extends Label implements ObjectControl<T> > > { > > > > > > > public T object; > > > > > > > private boolean objectText = false; > > > > > > > private Formatter<T> formatter = new DefaultFormatter(); > > > > > > > > public MyLabel() { > > > > > > > } > > > > > > > > public MyLabel(String text) { > > > > > > > super(text); > > > > > > > } > > > > > > > > public MyLabel(String id, String text) { > > > > > > > super(text); > > > > > > > id(id); > > > > > > > } > > > > > > > > public MyLabel(String id, String style, String text) { > > > > > > > this(id, text); > > > > > > > setStyleName(style); > > > > > > > } > > > > > > > > public MyLabel(Element element) { > > > > > > > super(element); > > > > > > > } > > > > > > > > public MyLabel<T> style(String style) { > > > > > > > setStyleName(style); > > > > > > > return this; > > > > > > > } > > > > > > > > public MyLabel<T> addStyle(String style, boolean condition) { > > > > > > > if (condition) { > > > > > > > addStyle(style); > > > > > > > } else { > > > > > > > removeStyleName(style); > > > > > > > } > > > > > > > return this; > > > > > > > } > > > > > > > > public MyLabel<T> addStyle(String style) { > > > > > > > addStyleName(style); > > > > > > > return this; > > > > > > > } > > > > > > > > public MyLabel<T> id(String id) { > > > > > > > IDUtil.id(this, id); > > > > > > > return this; > > > > > > > } > > > > > > > > public MyLabel<T> text(String text) { > > > > > > > setText(text); > > > > > > > return this; > > > > > > > } > > > > > > > > public MyLabel<T> html(String html) { > > > > > > > DOM.setInnerHTML(getElement(), html); > > > > > > > return this; > > > > > > > } > > > > > > > > public MyLabel<T> visible(boolean visible) { > > > > > > > setVisible(visible); > > > > > > > return this; > > > > > > > } > > > > > > > > public String text() { > > > > > > > return getElement().getInnerText(); > > > > > > > } > > > > > > > > public MyLabel<T> width(String value) { > > > > > > > setWidth(value); > > > > > > > return this; > > > > > > > } > > > > > > > > public String getText() { > > > > > > > return text(); > > > > > > > } > > > > > > > > public String html() { > > > > > > > return getElement().getInnerHTML(); > > > > > > > } > > > > > > > > public void setText(String text) { > > > > > > > super.setText(text); > > > > > > > } > > > > > > > > public MyLabel<T> object(T object) { > > > > > > > this.object = object; > > > > > > > if (objectText) { > > > > > > > updateObjectText(); > > > > > > > } > > > > > > > return this; > > > > > > > } > > > > > > > > public MyLabel<T> objectText() { > > > > > > > this.objectText = true; > > > > > > > updateObjectText(); > > > > > > > return this; > > > > > > > } > > > > > > > > public MyLabel<T> objectText(Formatter<T> formatter) { > > > > > > > this.formatter = formatter; > > > > > > > objectText(); > > > > > > > return this; > > > > > > > } > > > > > > > > private void updateObjectText() { > > > > > > > text(formatter.toString(object)); > > > > > > > } > > > > > > > > public T object() { > > > > > > > return object; > > > > > > > } > > > > > > > > public MyLabel<T> absoluteTopPx(int topPx) { > > > > > > > Style style = getElement().getStyle(); > > > > > > > style.setProperty("position", "absolute"); > > > > > > > style.setPropertyPx("top", topPx); > > > > > > > return this; > > > > > > > } > > > > > > > > public MyLabel<T> heightPx(int height) { > > > > > > > setHeight(height + "px"); > > > > > > > return this; > > > > > > > } > > > > > > > > public MyLabel<T> title(String title) { > > > > > > > setTitle(title); > > > > > > > return this; > > > > > > > } > > > > > > > > } > > > > > > > > On Jul 16, 1:29 pm, Jaroslav Záruba <[email protected]> > > > > wrote: > > > > > > > > > Could you post your MyLabel class? > > > > > > > > > On Fri, Jul 16, 2010 at 12:15 PM, evgenyk <[email protected]> > > > > wrote: > > > > > > > > > I do not know where to add such assertion. > > > > > > > > > I think I can't change anything. > > > > > > > > > As far as I understand exception is thrown inside Label > > > > constructor. > > > > > > > > > > On Jul 16, 12:08 pm, Jaroslav Záruba < > > [email protected]> > > > > > > > > > wrote: > > > > > > > > > > I had the same issue - no problem in hosted mode, > > "this$static > > > > is > > > > > > null" > > > > > > > > > in > > > > > > > > > > compiled. I found out I happen to call a method on null. > > > > Putting > > > > > > couple > > > > > > > > > of > > > > > > > > > > not-null assertions into your code might help. > > > > > > > > > > > On Fri, Jul 16, 2010 at 10:49 AM, evgenyk < > > [email protected]> > > > > > > wrote: > > > > > > > > > > > Hello friends! > > > > > > > > > > > I periodically get an exception thrown from the following > > > > > > compiled > > > > > > > > > > > code (not obfuscated version): > > > > > > > > > > > > function $MyLabel(this$static){ > > > > > > > > > > > $setElement(this$static, ($clinit_73() , > > > > > > > > > > > $doc).createElement('div')); > > > > > > > > > > > (!!this$static.element || > > throwAssertionError_Object("This > > > > > > > > > > > UIObject's element is not set; you may be missing a call > > to > > > > > > either > > > > > > > > > > > Composite.initWidget() or UIObject.setElement()") , this > > > > > > > > > > > $static.element)['className'] = 'gwt-Label'; > > > > > > > > > > > return this$static; > > > > > > > > > > > } > > > > > > > > > > > > Java version: > > > > > > > > > > > public class MyLabel extends Label { > > > > > > > > > > > public MyLabel(String text) { > > > > > > > > > > > super(text); > > > > > > > > > > > } > > > > > > > > > > > ... skipped other methods > > > > > > > > > > > } > > > > > > > > > > > > Exception is thrown time after time in production > > environment > > > > on > > > > > > > > > > > different client browsers with Firefox version 3.0.x on > > > > Windows > > > > > > XP. > > > > > > > > > > > It seems to me like a bug in FF. Is there any workaround, > > or > > > > I'm > > > > > > doing > > > > > > > > > > > something wrong? > > > > > > > > > > > GWT version 2.0.3 > > > > > > > > > > > > -- > > > > > > > > > > > You received this message because you are subscribed to > > the > > > > > > Google > > > > > > > > > Groups > > > > > > > > > > > "Google Web Toolkit" group. > > > > > > > > > > > To post to this group, send email to > > > > > > > > > [email protected]. > > > > > > > > > > > To unsubscribe from this group, send email to > > > > > > > > > > > [email protected]<google-web-toolkit%2Bunsubs > > > > > > > > > > > [email protected]><google-web-toolkit%2Bunsubs > > ... > > read more » -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
