Moved setCurrentPrincipal call outside of try/finally.