BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 08-25-2004, 04:03 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Aug 2004
Posts: 29
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default global try/catch

Please Login to Remove!

Hi,

I am trying to catch uncaught errors in my application with a global try/catch.
My problem is that, in my catch, I would like to display a message (something that could be like Microsoft's famous blue screen) with that code :
public static void main(String[] args) {

try{
Youpi theApp=new Youpi ();
theApp.enterEventDispatcher();
}catch(Exception e){

}
Application.getApplication().invokeLater(new Runnable() {

public void run() {
Dialog.alert("Your application has crashed down");
UiApplication.getUiApplication().updateDisplay();
System.exit(-1);
}
});


}
Nothing happens, the message does not display and the application does not exit
anyone could help me please?
Offline  
Old 08-25-2004, 01:38 PM   #2 (permalink)
Retired BBF Moderator
 
Mark Rejhon's Avatar
 
Join Date: Aug 2004
Location: Ottawa, Ontario, Canada
Model: Bold
Carrier: Rogers
Posts: 4,870
Post Thanks: 1
Thanked 0 Times in 0 Posts
Default

Although I am familiar with programming many other platforms (I have been programming for 19 years), I haven't made software for BlackBerry yet, but let me try to provide a few leads:

(1) Possibility One.
From certain platforms I believe you cannot display messages during certain kinds exceptions, especially operating-system-related exceptions. To solve this, you may have to set a variable flag that another handler checks and display the message in there instead. This may not apply to Blackberry, but I should mention this.

(2) Possibility Two
Another thing is that your exception handler is not even being executed at all. You will need to debug this. (Exception debugging is a toughie, inconsistent behaviour on different platforms too)

(3) Possibility Three
Displaying not updating before the crash, or that your alert message is non-blocking (i.e. does not pause all application threads when the message is displayed -- your message could be pre-empted if your application exits before the 'OK' is clicked on). I am not sure if that particular alert message is blocking (as in fully application modal, in Windows-ese programming terminology)

(4) Possibility Four
Look for ther source-code-available applications like those I listed, and study how this particular exception handling is done. Reverse engineer the technique into your software if allowed to do so. (i.e. open source applications are a good learning tool -- see the other links in this forum -- though you will have to rewrite the code on your own for proprietary use)
__________________
Thanks,
Mark Rejhon
Author of XMPP extension XEP-0301:
www.xmpp.org/extensions/xep-0301.html - specification
www.realjabber.org - open source
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Lot of (3) Glassmike Capacitors - ASG 52 - .0005 MFD, 30,000 WVDC
$24.95
Lot of (3) Glassmike Capacitors - ASG 52 - .0005 MFD, 30,000 WVDC picture1 Mallory 2400MF 450vdc 525 vdf CGS Capacitors Very High Quality cap 2400uf
$12.96
1  Mallory 2400MF 450vdc 525 vdf CGS Capacitors Very High Quality cap 2400uf pictureLot of (18) Glassmike ASG 23 Capacitors - .01 MFD, 3000 WVDC
$79.95
Lot of (18) Glassmike ASG 23 Capacitors - .01 MFD, 3000 WVDC pictureNew Schneider Electric 27107 MN Under Voltage Release used on C60 C120 Circuits
$169.99
New Schneider Electric 27107 MN Under Voltage Release used on C60 C120 Circuits pictureSchneider Electric MG24474 Circuit Breaker, Multi 9, C60N, 63A; DIN Rail; 3 Pole
$259.99
Schneider Electric MG24474 Circuit Breaker, Multi 9, C60N, 63A; DIN Rail; 3 Pole picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.