Why removing null check for headId ? Is there a guarantee that db can always resolve HEAD ?

FindBugs complains that currentHeadId is never written, I suspect inside this if block currentHeadId should be set to headId then the TODO comment would make sense