From 2defaa19ea42c2d56d3e8a8e192b9c65ea09d6b0 Mon Sep 17 00:00:00 2001 From: Ammar Abdulhamid Date: Fri, 20 Nov 2020 03:37:08 +0100 Subject: [PATCH] Simplify try-block and exception rethrow Since we only want close the reader and entity loader, there's no need for catch and rethrow as finally can handle this as we want. Change-Id: I52c1e597e1588941d50211d1c71fc19cc414d8e4 --- includes/import/WikiImporter.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/includes/import/WikiImporter.php b/includes/import/WikiImporter.php index 8c47983f04a..f88950a9985 100644 --- a/includes/import/WikiImporter.php +++ b/includes/import/WikiImporter.php @@ -626,16 +626,9 @@ class WikiImporter { $keepReading = $this->reader->read(); } } - } catch ( Exception $ex ) { - $rethrow = $ex; - } - - // finally - libxml_disable_entity_loader( $oldDisable ); - $this->reader->close(); - - if ( $rethrow ) { - throw $rethrow; + } finally { + libxml_disable_entity_loader( $oldDisable ); + $this->reader->close(); } return true;