avoiding PMD rule violation: empty check exception