Fixing the coverity issues for java