The method is supposed to return how much XP was actually removed. At the moment it returns the amount to be removed even if the player has no XP.
Also, should it remove from the player score? Afaik vanilla does not lower the score when XP is removed (e.g. enchanting).