Hmmmm.... I should have put it better.
What I meant was that I need to count the total number of exceptions
thrown by the methods in all classes in a project - they may be caught
some place else... but if they are being thrown... I need to count
them.
I was thinking of javadocs... but thot checkstyle would be better. Will
have a look at both.
As for the usefullness of the metric... in my case it does seem to be a
worthwhile figure to have.
Thanks for the reply!
Manu
Manu Mahendru wrote On 01/10/06 12:48,:
> Hmmmm.... I should have put it better.
>
[quoted text clipped - 8 lines]
> As for the usefullness of the metric... in my case it does seem to be a
> worthwhile figure to have.
I think you still have a specification issue.
For example, in
void foo()
throws SocketException, ProtocolException
{ ... }
void bar()
throws IOException
{ ... }
how many exceptions do you want to count for each method?
(Note that bar() can throw anything foo() can, and more.)

Signature
Eric.Sosman@sun.com
Oliver Wong - 10 Jan 2006 19:54 GMT
> Manu Mahendru wrote On 01/10/06 12:48,:
>> Hmmmm.... I should have put it better.
[quoted text clipped - 23 lines]
> how many exceptions do you want to count for each method?
> (Note that bar() can throw anything foo() can, and more.)
As a naive first attempt at the problem, which may be good enough for
the OP, you could just do a plain text search for the string "throw" in all
your Java source files, and count how many times they occur. You can then
refine this solution to ignore matches found inside of strings and comments.
I believe this can easily be done with a simple DFA, so in practice I'd use
an regular expression engine if one were already available to me, or I'd
write a quick and dirty DFA engine to process the text files for me.
- Oliver