Apache Lucene open-source search software
SOLR-7014: Collapse identical catch branches in try-catch statements in morphlines-core
Shalin Shekhar Mangarad298b70cfaf
diff --git a/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/LoadSolrBuilder.java b/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/LoadSolrBuilder.javaindex 0b31f5444c9..2c2660b6195 100644--- a/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/LoadSolrBuilder.java+++ b/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/LoadSolrBuilder.java@@ -85,35 +85,27 @@ public final class LoadSolrBuilder implements CommandBuilder {if (event == Notifications.LifecycleEvent.BEGIN_TRANSACTION) {try {loader.beginTransaction();- } catch (SolrServerException e) {- throw new MorphlineRuntimeException(e);- } catch (IOException e) {+ } catch (SolrServerException | IOException e) {throw new MorphlineRuntimeException(e);}} else if (event == Notifications.LifecycleEvent.COMMIT_TRANSACTION) {try {loader.commitTransaction();- } catch (SolrServerException e) {- throw new MorphlineRuntimeException(e);- } catch (IOException e) {+ } catch (SolrServerException | IOException e) {throw new MorphlineRuntimeException(e);}}else if (event == Notifications.LifecycleEvent.ROLLBACK_TRANSACTION) {try {loader.rollbackTransaction();- } catch (SolrServerException e) {- throw new MorphlineRuntimeException(e);- } catch (IOException e) {+ } catch (SolrServerException | IOException e) {throw new MorphlineRuntimeException(e);}}else if (event == Notifications.LifecycleEvent.SHUTDOWN) {try {loader.shutdown();- } catch (SolrServerException e) {- throw new MorphlineRuntimeException(e);- } catch (IOException e) {+ } catch (SolrServerException | IOException e) {throw new MorphlineRuntimeException(e);}}@@ -127,9 +119,7 @@ public final class LoadSolrBuilder implements CommandBuilder {SolrInputDocument doc = convert(record);try {loader.load(doc);- } catch (IOException e) {- throw new MorphlineRuntimeException(e);- } catch (SolrServerException e) {+ } catch (IOException | SolrServerException e) {throw new MorphlineRuntimeException(e);} finally {timerContext.stop();diff --git a/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/SolrLocator.java b/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/SolrLocator.javaindex e4f65c4e94b..10a80ff953b 100644--- a/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/SolrLocator.java+++ b/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/SolrLocator.java@@ -140,11 +140,7 @@ public class SolrLocator {downloadedSolrHomeDir = Files.createTempDir();downloadedSolrHomeDir = zki.downloadConfigDir(zkClient, configName, downloadedSolrHomeDir);mySolrHomeDir = downloadedSolrHomeDir.getAbsolutePath();- } catch (KeeperException e) {- throw new MorphlineCompilationException("Cannot download schema.xml from ZooKeeper", config, e);- } catch (InterruptedException e) {- throw new MorphlineCompilationException("Cannot download schema.xml from ZooKeeper", config, e);- } catch (IOException e) {+ } catch (KeeperException | InterruptedException | IOException e) {throw new MorphlineCompilationException("Cannot download schema.xml from ZooKeeper", config, e);} finally {zkClient.close();@@ -161,11 +157,7 @@ public class SolrLocator {IndexSchema schema = new IndexSchema(solrConfig, "schema.xml", is);validateSchema(schema);return schema;- } catch (ParserConfigurationException e) {- throw new MorphlineRuntimeException(e);- } catch (IOException e) {- throw new MorphlineRuntimeException(e);- } catch (SAXException e) {+ } catch (ParserConfigurationException | IOException | SAXException e) {throw new MorphlineRuntimeException(e);}} finally {