api/core PMD & FindBugs fixes