In the meteorology domain (and probably most time-centric domains?)
times are always in 24 hr clock mode, and mostly in zulu time (Timezone
= UTC/GMT). So I built a BugDetector for our local code such that it
would flag things like bad use of Calendar.HOUR where HOUR_OF_DAY intended
Calendar c;
c.set( Calendar.HOUR, 13 ); bad, will be stored as 1 not 13
int h = c.get( Calendar.HOUR ); bad, would return stored 20 as 8
It also catches common errors setting month 1-12 where 0-11 expected.
For a local Java user group, I packaged this up and made it available as
a zip. I guess it may be of interest for this group too....
http://bradman.apl.washington.edu, it's the "Java Findbugs demo... "
link. Unzip and follow the README.
I don't think this finder is general enough for the contrib package, but
it might be??
Comments welcomed
Stuart
|
|