commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benedikt Ritter <benerit...@gmail.com>
Subject Re: [all] FindBugs' Switch statement found in class.method where default case is missing
Date Tue, 04 Sep 2012 13:02:15 GMT
Hi Gary,

IMHO FindBugs is supposed to point you at code fragments that
potentially could cause subtle bugs. If say that the code in codec is
carefully constructed and everything is backed up by junit tests, I'd
say a default clause is nosy and doesn't add anything.
OTOH if you can not see that no default clause is required at first
sight, I would prefer a default clause in favor of a code comment.

Benedikt

2012/9/4 Gary Gregory <garydgregory@gmail.com>:
> Hi All:
>
> FindBugs can give warnings like:
>
> Switch statement found in
> org.apache.commons.codec.binary.Base32.decode(byte[], int, int,
> BaseNCodec$Context) where default case is missing
>
> In this case for [codec], it looks like the code was carefully constructed
> and that no default clause is needed.
>
> In these cases for any component, this FindBugs issue feels like a style
> issue, is it worth changing the code to add a default clause like:
>
>    default:
>       // ok to fall through for other values.
>       break;
>
> Or does this feel like noise to you all?
>
> Gary
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
> Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message