incubator-jspwiki-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "van Dalen, Andre" <>
Subject RE: Sonar complaint: declaring unchecked exceptions in the throws clause
Date Fri, 19 Jul 2013 11:25:54 GMT
Hi Glen,

I would have Sonar ignore these warnings, and see if it is possible to annotate the source
with a suppression
for the cases that are checked and deemed a correct use of an unchecked exception.
After that the Sonar warning can be enabled again. For library-type methods unchecked exceptions
are the norm imho
(look at the String javadoc). As you say, the exceptions that are thrown should document themselves
so removing
the throw clauses from code and javadoc is not the way to go.

	regards, Andre

-----Original Message-----
From: Glen Mazza [] 
Sent: 18 July 2013 22:54
Subject: Sonar complaint: declaring unchecked exceptions in the throws clause

Hi Team, in 40-44 cases (which isn't all that much), Sonar is reporting that we're unnecessarily
declaring unchecked (Runtime-derived) exceptions such as MissingResourceException and IllegalArgumentException
in the "throws" clause, as listed here:
(click on TextUtil, InternationalizationManager in the lower-right corner).

These can be kind of nice because it becomes better self-documenting that way, although prevailing
opinion[1] seems to be that RuntimeExceptions should be those outside of anybody's control,
and checked (must declare in the throws clause) exceptions should be used instead when the
exception is something somebody can do something about.

What I'd like to do is remove them from the "throws" clause--quieting Sonar--but keep them
in the Javadoc above, so they're still documented.  
(Alternatively, what I can do is disable this check--have Sonar ignore
it.)  Later, for these exceptions, we may wish to move to checked exceptions if any of these
are something a developer do something about, while leaving IllegalArgumentException, etc.,
for programming errors outside of any user's control.  WDYT?



View raw message