Getting a weird error in a GWT-generated function.

11 views
Skip to first unread message

Dmitri V

unread,
May 16, 2008, 9:25:08 PM5/16/08
to Google Web Toolkit
Hi all,

A bit of quick background info: I'm using the compiled JavaScript to
develop a Firefox extension (which is a simple login app). It's been
working relatively well so far, but I've come across a problem when I
implemented Remote Procedure Call (RPC) mechanism. The Java code
compiled without any problems, but when I ran it, I got an error when
executing the (Java) function that actually makes the RPC call.
Surprisingly, the error is not in what I wrote (as far as I can see),
but rather in one of the GWT-generated helper functions. Here's the
function itself:

function java_lang_StringBuffer_
$append__Ljava_lang_StringBuffer_2Ljava_lang_String_2(this$static,
toAppend){
if (toAppend === null) {
toAppend = 'null';
}
var last = this$static.js.length - 1;
var lastLength = this$static.js[last].length;
if (this$static.length > lastLength * lastLength) {
this$static.js[last] = this$static.js[last] + toAppend;
}
else {
this$static.js.push(toAppend);
}
this$static.length += toAppend.length;
return this$static;
}

At some point in execution, toAppend is undefined, which generates an
error when toAppend.length is called.

I'm really having trouble tracking down the source of this problem.
Part of me thinks that my code is not initializing a variable or
something like that correctly, and another part of me wonders why the
GWT-generated code doesn't check that toAppend is undefined and handle
it appropriately.

Can anyone shed any light on this problem? Would be greatly
appreciated.

Olivier Monaco

unread,
May 17, 2008, 6:13:40 AM5/17/08
to Google Web Toolkit
Hi,

Which version of GWT do you use? Did you try to run your project in
Hosted mode? Did you call setServiceEntryPoint? If you have FireBug
installed you may try to check where the toAppend value come from...

Olivier.

jeya.balaji

unread,
May 19, 2008, 2:41:35 AM5/19/08
to Google Web Toolkit
I am facing the similar issue. I dont get the append error thou.
The apps is working in hosted env. The screen is blank in a browser.

I commented the portion that has rpc call and I am seeing colorful
panels in the browser.

Upon analyzing through firebug, it looks like only rpc data fetch is
executed. I could see the data pulled from the db and they are valid
data. After the data is fetched, the screen is empty, as thou the rpc
didnt return the control to the screen painting modules. (there is no
error reported by firebug)

setServiceEntryPoint is set as the apps is working in hosted env.
Using gwt 1.4.62

Thanks
Balaji

Dmitri V

unread,
May 28, 2008, 1:49:51 PM5/28/08
to Google Web Toolkit
Hi, thanks for replying.

I use GWT 1.4.61.

setServiceEntryPoint() is set, and I tried running it in Hosted mode,
and it actually ran in the sense that the prodecure call executed and
then the onFailure callback method was called. I'm having other issues
with exceptions in Hosted mode (thread here:
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/dd00a505d2095873)
right now, so I haven't even tried running the new code in non-hosted
mode. When I do, I'll bump this thread with whether or not the error
persists.

Dmitri V

unread,
May 30, 2008, 4:23:28 PM5/30/08
to Google Web Toolkit
Yeah, tried the new code in non-hosted mode and still get same
error....

On May 28, 1:49 pm, Dmitri V <dmitri...@gmail.com> wrote:
> Hi, thanks for replying.
>
> I use GWT 1.4.61.
>
> setServiceEntryPoint() is set, and I tried running it in Hosted mode,
> and it actually ran in the sense that the prodecure call executed and
> then the onFailure callback method was called. I'm having other issues
> with exceptions in Hosted mode (thread here:http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...)

Sumit Chandel

unread,
Jun 2, 2008, 6:02:35 PM6/2/08
to Google Web Toolkit
Hi Dmitri,

The errors you described here and in the linked thread seem
symptomatic of something I've seen before. Specifically, problems like
this sometimes occur when there is a version conflict with the JARs
that were used during the GWT compilation process and the JARs that
are deployed on the server where the servlets are defined.

Can you double-check that you compiled your application with the same
GWT version as the gwt-servlet.jar that's deployed on your server?
Also, check that the shell script or run configuration you're using to
start hosted mode has the right version of the gwt-servlet.jar on its
classpath.

As for trying to identify if this problem also has something to do
with the extension you're working on itself, you can try creating a
simple JavaScript function that sends an XHR out to your server, and
check to see if the request makes it through.

Try it out and let us know how it goes.

Hope that helps,
-Sumit Chandel

todd....@gmail.com

unread,
Jun 2, 2008, 6:32:44 PM6/2/08
to Google Web Toolkit
I had a similar error awhile back. I did something silly like creating
an object that extended HashSet. This is typically fine but I was
experimenting in my IDE and accidentally overrode something like
iterator() with the default return null. It took a long time to track
down.

Are you by chance overriding a method in StringBuffer like what I
discribed?
Reply all
Reply to author
Forward
0 new messages