NULL Points + Fire Fox

49 views
Skip to first unread message

Sean

unread,
Jul 16, 2012, 8:47:29 PM7/16/12
to google-we...@googlegroups.com
So I made a bone head mistake and had a null pointer error. essentially I had

user = loadUser();

if( user == null)
{
   Make login screen
}
else{
  populate user

if(user.name == Sean)
{
   do something
}

So obviously that nulls out if I'm not logged in. Here's the rub, it worked fine in development mode. It didn't toss an error or anything. When I deployed it, I was met with no errors, only a blank screen. However, Firefox worked fine. This took me HOURS to figure out. 

Any idea why it works in dev mode and FireFox? I wish it stopped working ASAP (like it should) so I know, Oh, that line I just put in made it stop working instead of it happening hours later when I'm deploying it. 

Paul Stockley

unread,
Jul 16, 2012, 8:53:13 PM7/16/12
to google-we...@googlegroups.com
I can tell you that if you are working in anyway with JSO objects, devmode will mask out null pointer exceptions. Maybe this is related. The problem has to do with the JS method devmode uses to execute the JSNI code in the browser. The stupid JS spec says if an object is null just do nothing, When executing the JS for real this method isn't used and you get an error.

Thomas Broyer

unread,
Jul 17, 2012, 2:49:14 AM7/17/12
to google-we...@googlegroups.com


On Tuesday, July 17, 2012 2:53:13 AM UTC+2, Paul Stockley wrote:
I can tell you that if you are working in anyway with JSO objects, devmode will mask out null pointer exceptions. Maybe this is related. The problem has to do with the JS method devmode uses to execute the JSNI code in the browser. The stupid JS spec says if an object is null just do nothing, When executing the JS for real this method isn't used and you get an error.

It's not "just do nothing", it's "use the global object" (or maybe "look up the scope chain").
To make things clear for everyone: DevMode executes JSNI method's by using .call() on the JS Function, passing the 'this' object (jsniFunc.call(thisObj, args)), and that object can be 'null', executing the method with the global object (equivalent to 'window') as the 'this' object. In prod mode though, the code is compiled to a real method call (thisObj.jsniFunc(arg1, arg2), or "staticified" as jsniFunc(thisObj, arg1, arg2)) and then there can be a "null has no jsniFunc property" error at runtime.

Thomas Broyer

unread,
Jul 17, 2012, 8:30:37 AM7/17/12
to Sean, Google Web Toolkit
On Tue, Jul 17, 2012 at 1:36 PM, Sean <slou...@gmail.com> wrote:
> Thanks for the feed back guys. I'm going to have to deploy more often then,
> null pointers are nasty to find with no stack trace.

No need to redeploy, use Super Dev Mode ;-)
Reply all
Reply to author
Forward
0 new messages