CAn you please pull out getPath().getParentPath().getLeaf() into a private method that is named for the logical operation you're doing here by walking the tree?