Refactoring methods with incorrect exception handling