Static analysis fixes

| Q                    | A
| -------------------- | ---
| Bug fix?             | N
| New feature?         | N
| BC breaks?           | N
| CI currently passes? | N
| Tests pass?          | Y
| Scenarios pass?      | Y
| Checkstyle issues?*  | N
| PMD issues?**        | N
| Changelog updated?   | N
| Fixed tickets        | ~
| DB schema updated?   | N
| Migration script?    | ~
| Doc PR               | ~