AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Overriding (or something similar) Exceptions

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> JVM, native methods and hardware
View previous topic :: View next topic  
Author Message
graham.parsons@reflective
Guest





PostPosted: Mon Nov 13, 2006 11:33 pm    Post subject: Overriding (or something similar) Exceptions Reply with quote



Hi guys,

We have a "legacy" Java application that has been developed by many
developers - some handle exceptions nicely, others not so.

What I would like to do is create a log of all the exceptions and
messages that are being thrown internally without changing the code.

I was thinking around the classloader - create my own Exception class
which uses the standard one but before passing the call to the standard
one, writes out to the log.

So mine is loaded by the JVM but all I do is extend the standard one
and override a method - is this "cyclic dependancy possible"?

If not, can anyone suggest any other route I could take to get the
desired functionality?

Cheers

Graham
Back to top
Oliver Wong
Guest





PostPosted: Tue Nov 14, 2006 1:43 am    Post subject: Re: Overriding (or something similar) Exceptions Reply with quote



<graham.parsons (AT) reflective (DOT) com> wrote in message
news:1163439189.887227.93360 (AT) m7g2000cwm (DOT) googlegroups.com...
Quote:
Hi guys,

We have a "legacy" Java application that has been developed by many
developers - some handle exceptions nicely, others not so.

What I would like to do is create a log of all the exceptions and
messages that are being thrown internally without changing the code.

I was thinking around the classloader - create my own Exception class
which uses the standard one but before passing the call to the standard
one, writes out to the log.

So mine is loaded by the JVM but all I do is extend the standard one
and override a method - is this "cyclic dependancy possible"?

If not, can anyone suggest any other route I could take to get the
desired functionality?

Look into Aspect Oriented Programming, and AspectJ.

- Oliver
Back to top
Tris Orendorff
Guest





PostPosted: Tue Nov 14, 2006 5:45 am    Post subject: Re: Overriding (or something similar) Exceptions Reply with quote



"graham.parsons (AT) reflective (DOT) com" <graham.parsons (AT) reflective (DOT) com> burped up
warm pablum in news:1163439189.887227.93360 (AT) m7g2000cwm (DOT) googlegroups.com:

Quote:
Hi guys,

We have a "legacy" Java application that has been developed by many
developers - some handle exceptions nicely, others not so.

What I would like to do is create a log of all the exceptions and
messages that are being thrown internally without changing the code.

I was thinking around the classloader - create my own Exception class
which uses the standard one but before passing the call to the standard
one, writes out to the log.

So mine is loaded by the JVM but all I do is extend the standard one
and override a method - is this "cyclic dependancy possible"?

If I understand you, you can do this. Exceptions and classes are very
similar so you can say, "public class Mine extends IOException {}" and
write a new constructor. You still have to change the code to use your
new exceptions.

So my second suggestion would be to add the logging code to the runtime
library and whip up a special rt.jar file.

--
Sincerely,

Tris Orendorff
[Q: What kind of modem did Jimi Hendrix use?
A: A purple Hayes.]
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> JVM, native methods and hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.