Umbrella Exception

130 views
Skip to first unread message

Natasha

unread,
Jul 26, 2011, 11:31:36 AM7/26/11
to gwtai
Hi,

I am a newbie, and I tried to implement the GwtAI library so I can use
an applet in my GWT application.
I followed the tutorial for setting GwtAI, but when I start the
application and when I click on the Increment button that is descriped
in the tutorial, I get an Umbrella Exception.
I do not know why I am getting this exception, so I would like to ask
you if you have some similar experience to help me.

Thanks

Drossen Koren

unread,
Jan 8, 2014, 5:03:30 PM1/8/14
to gw...@googlegroups.com
I realize that this is an old topic, but I wish to clarify something, which may help some developers in the future.  First of all, the Umbrella Exception is a GWT catch-all for uncaught exceptions.  Without seeing the source code, GWT module files, etc. for the application mentioned in the first post in this topic, there is no way to know what actually caused the uncaught exception.  One possibility is not catching an exception thrown from a method that is known can throw exceptions (i.e. it has a throws clause).  Another possibility, is failing to check if an object is not null before using it, and not catching the NullPointerException.  The following are some tips on good coding practices, which may help avoid these types of problems:

  • Put try/catch blocks, anywhere in your code, where you call methods which may throw exceptions.
  • Always check if the values, returned from a method call, are non-null before using them.
  • You should check if arguments, passed to a method, are non-null before using them.
    • In some situations, it may be acceptable to skip checking the arguments if the API states that a NullPointerException will be thrown if the argument is null, in which case, it is up to the caller of the method to either check if the value they are passing is non-null or to catch the NullPointerException.
  • Always check the arguments passed to callback methods in GWT/GWTAI before using them, as the results may be null, even if the call indicates success.
  • Use the java logging API in, GWT client side code, to log errors in your try/catch blocks, and to log debug messages in places where they make sense, to help debug/troubleshoot issues with your application.

The main point I wish to stress, is to strive to make your code as robust as possible in order to avoid uncaught exceptions from bubbling up to the Umbrella Exception handler GWT provides.

- Drossen
Reply all
Reply to author
Forward
0 new messages