Fix Java code issues based on IntelliJ IDEA analysis