Some minor cleanups based on Checkstyle/Findbugs/PMD

A bunch of minor cleanups, based on some static analysis tools.