View Full Version : XTemplate Upgrade Issue

7 Jan 2011, 6:44 AM

Today I upgraded my project from using GXT 2.1.1 to GXT 2.2.1
In a few places, I use Templates to format and display models that contain simple data and a couple submodels that also contain simple data.

This code converts one of my simple models (String properties and models that contain string properties) to a JsObject and then applies a template to it.

public void onSuccess(String result) {
JavaScriptObject obj = Util.getJsObject(theAd, 4);

This code worked perfectly in GXT 2.1.1.
However, in GXT 2.2.1, I constantly get the following error:

Uncaught exception escaped
com.google.gwt.core.client.JavaScriptException: (TypeError): Cannot read property 'COMPANYNAME' of null
stack: TypeError: Cannot read property 'COMPANYNAME' of null
at [object Object].<anonymous> (eval at <anonymous> (http://localhost:8084/AdDeskBreeze/Breeze/hosted.html?Breeze:54:12))
at [object Object].applySubTemplate (unknown source)
at [object Object].<anonymous> (eval at <anonymous> (http://localhost:8084/AdDeskBreeze/Breeze/hosted.html?Breeze:54:12))
at [object Object].<anonymous> (unknown source)
at [object Object].<anonymous> (unknown source)
at __gwt_jsInvoke (http://localhost:8084/AdDeskBreeze/Breeze/hosted.html?Breeze:76:35)
at eval at <anonymous> (http://localhost:8084/AdDeskBreeze/Breeze/hosted.html?Breeze:54:12)
at XMLHttpRequest.<anonymous> (unknown source)
at unknown source
at __gwt_jsInvoke (http://localhost:8084/AdDeskBreeze/Breeze/hosted.html?Breeze:76:35)
type: non_object_property_load arguments: COMPANYNAME, __gwt_ObjectId: 2827
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:237)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Thread.java:619)

However, when debugging, the model being converted to a JsObject has a COMPANYNAME property in its properties map. Can you help me figure out what is going on here? It seems like code has been changed that is making the Util.getJsObject(...) call not convert the model properly.

7 Jan 2011, 7:12 AM
Is there any good way to debug what the resulting JsObject contains?
I've tried using JavaScriptObject's toString() method, which just returns "[object Object]."
I've tried using JavaScriptObject's toSource() method, which just returns null.

It seems to be impossible to find out how the object has been converted...any help?

7 Jan 2011, 7:13 AM
The easist would be if you could try to reproduce this in a small standalone testcase implementing EntryPoint.

7 Jan 2011, 8:31 AM
I reverted my upgrade changes.
When using GXT2.1.1 and GWT 2.0.3, this problem didn't occur.

I then upgraded GWT to 2.1.1. Still no error.
I then upgraded GXT to 2.2.1, and then the error occurs.
Unfortunately, the code is too complex for me to boil down to something simple in a reasonable amount of time.
I'll continue to work at it and eventually figure out a work around.

7 Jan 2011, 8:36 AM
It should be really simple to reproduce this. Simple give use your "theAd" object. Should only take a few minutes to reproduce this.