From 6287a1300aaae19f79291d622facb7e193958092 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Mon, 1 Feb 2016 10:27:33 +0100 Subject: [PATCH] Catch IOExcption after core change Original commit: elastic/x-pack-elasticsearch@1fa5a3dc82da8004524502eacd3d456cd917cc1c --- .../test/java/org/elasticsearch/marvel/MarvelF.java | 12 ++++++++++-- .../test/java/org/elasticsearch/shield/ShieldF.java | 12 ++++++++++-- .../java/org/elasticsearch/watcher/WatcherF.java | 12 ++++++++++-- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/MarvelF.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/MarvelF.java index f905d0fe2d6..58a71f70832 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/MarvelF.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/MarvelF.java @@ -5,6 +5,8 @@ */ package org.elasticsearch.marvel; +import org.apache.lucene.util.IOUtils; +import org.elasticsearch.ElasticsearchException; import org.elasticsearch.Version; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.CollectionUtils; @@ -12,6 +14,7 @@ import org.elasticsearch.node.MockNode; import org.elasticsearch.node.Node; import org.elasticsearch.xpack.XPackPlugin; +import java.io.IOException; import java.util.Arrays; import java.util.concurrent.CountDownLatch; @@ -42,8 +45,13 @@ public class MarvelF { @Override public void run() { - node.close(); - latch.countDown(); + try { + IOUtils.close(node); + } catch (IOException e) { + throw new ElasticsearchException(e); + } finally { + latch.countDown(); + } } }); node.start(); diff --git a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/ShieldF.java b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/ShieldF.java index d33162a458d..6cd2fea8edd 100644 --- a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/ShieldF.java +++ b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/ShieldF.java @@ -5,6 +5,8 @@ */ package org.elasticsearch.shield; +import org.apache.lucene.util.IOUtils; +import org.elasticsearch.ElasticsearchException; import org.elasticsearch.Version; import org.elasticsearch.common.io.PathUtils; import org.elasticsearch.common.settings.Settings; @@ -17,6 +19,7 @@ import org.elasticsearch.shield.test.ShieldTestUtils; import org.elasticsearch.test.ShieldSettingsSource; import org.elasticsearch.xpack.XPackPlugin; +import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.Arrays; @@ -64,8 +67,13 @@ public class ShieldF { @Override public void run() { - node.close(); - latch.countDown(); + try { + IOUtils.close(node); + } catch (IOException ex) { + throw new ElasticsearchException(ex); + } finally { + latch.countDown(); + } } }); node.start(); diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/WatcherF.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/WatcherF.java index 67980215353..78b8a2b89bd 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/WatcherF.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/WatcherF.java @@ -5,6 +5,8 @@ */ package org.elasticsearch.watcher; +import org.apache.lucene.util.IOUtils; +import org.elasticsearch.ElasticsearchException; import org.elasticsearch.Version; import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.settings.Settings; @@ -12,6 +14,7 @@ import org.elasticsearch.node.MockNode; import org.elasticsearch.node.Node; import org.elasticsearch.xpack.XPackPlugin; +import java.io.IOException; import java.util.Arrays; import java.util.concurrent.CountDownLatch; @@ -58,8 +61,13 @@ public class WatcherF { @Override public void run() { - node.close(); - latch.countDown(); + try { + IOUtils.close(node); + } catch (IOException e) { + throw new ElasticsearchException(e); + } finally { + latch.countDown(); + } } }); node.start();