Fix PMD, Findbugs and some Checkstyle errors.