Re: [OpenMap Users] anyone know how to "catch" the first occurrence of NaN?

From: Adrian Lumsden <Adrian.Lumsden@sss.co.nz>
Date: Wed Feb 19 2003 - 15:44:01 EST

Hello Ed,

I'm a bit new to Java so ...

Can you fix this by using some form of try ... catch thing and then
finding out where the exception occurred?

In "Java 2. Performance and Idiom Guide" (Craig Larman and Rhett Guthrie,
Prentice Hall PTR, 2000, ISBN 0-13-014260-3) Section 10.2, pp 190-191
there's a piece on implementing an Emergency Error Handler" which catches
all otherwise un-caught exceptions. To quote:-

"The following Mainclass is written to extend ThreadGroup and handle all unexpected application exceptions. Note that all threads
created from the application will belong to the custom threadgroup unless
they are explicitly created in another threadgroup (as is the case for
some system threads). Because of this, all unhandled exceptions occurring
on application threads will wind up invoking the custom uncaughtException method."

        public class Main extends ThreadGroup {

                private Main() {
                        super("Application");
                        }

                public static void main(String[] args) {
                        Runnable appStarter = new Runnable() {
                                public void run() {
                                        // Invoke method to start
application
                                        }
                                };

                        new Thread(new Main(), appStarter).start();
                        }

                public void uncaughtException(Thread t, Throwable ex) {
                        // process/log error
                        }

                }

I haven't tested or even tried this yet. It's on my list!

Hope that helps,

Adrian
_____________________________________________

Adrian Lumsden
Product Specialist
Scientific Software and Systems Limited

Tel: +64 4 917-6680 (direct)
        +64 4 917-6670 (reception)
Fax: +64 4 917-6671
E-mail: Adrian.Lumsden@spamtrap.sss.co.nz

Visit us on the Web at: http://www.sss.co.nz
_____________________________________________

This e-mail passed SSS's content security scan.
It is covered by the confidentiality clauses at
http://www.sss.co.nz/content_and_confidentiality

Ed MacKerrow <mackerrow@lanl.gov>
Sent by: owner-openmap-users@bbn.com
20/02/03 08:43

 
        To: openmap-users@bbn.com
        cc:
        Subject: [OpenMap Users] anyone know how to "catch" the first occurrence of NaN?

I am having trouble with a NaN value being generated in some code. The
trouble is that I do not know a priori where this is being generated. I
may have to paint my code with conditionals based on Double.NaN checks,
but would prefer not to.
 
Any help would be appreciated.
 
Thanks
 
ed
 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Ed MacKerrow
Theoretical Division, T-13, Complex Systems
Mail Stop - B213 Los Alamos National Laboratory
Los Alamos, NM 87545
(505) 665-3491 (office)
(505) 603-0352 (cell)
(505) 665 - 3003 (fax)
mackerrow@lanl.gov

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Wed Feb 19 15:45:33 2003

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:34 EDT