Tidy up java warnings and sonar
166 files changed