Fixes JENKINS-45294, JENKINS-47425, JENKINS-47901, JENKINS-47942 + about 50 reported FindBugs issues (JENKINS-37566). There are 13 FindBugs issues left, work in progress. (cherry picked from commit bcd0b2c7)