Fix bug where getdensity call to java was leaking local refs