From 36a8c24b6b6083ecde1ccec0bcca599c0ff56c54 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Fri, 1 Jul 2016 13:45:16 -0700 Subject: [PATCH] Uninject HtmlSanitizer This is just a utility used by the email action and does not need to be injected. Original commit: elastic/x-pack-elasticsearch@4555db634ce35b1aced0ae573ba1314f9604bb87 --- .../cluster/ClusterStatsResolverTests.java | 2 +- .../xpack/notification/NotificationModule.java | 1 - .../xpack/notification/email/HtmlSanitizer.java | 3 +-- .../watcher/actions/email/EmailActionFactory.java | 4 ++-- .../watcher/actions/email/EmailActionTests.java | 14 +++++--------- .../xpack/watcher/watch/WatchTests.java | 2 +- 6 files changed, 10 insertions(+), 16 deletions(-) diff --git a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/cluster/ClusterStatsResolverTests.java b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/cluster/ClusterStatsResolverTests.java index f9ac50ce672..8a0be5b73c2 100644 --- a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/cluster/ClusterStatsResolverTests.java +++ b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/resolver/cluster/ClusterStatsResolverTests.java @@ -109,7 +109,7 @@ public class ClusterStatsResolverTests extends MonitoringIndexNameResolverTestCa BoundTransportAddress transportAddress = new BoundTransportAddress(new TransportAddress[]{DummyTransportAddress.INSTANCE}, DummyTransportAddress.INSTANCE); return new NodeInfo(Version.CURRENT, org.elasticsearch.Build.CURRENT, - new DiscoveryNode("node_0", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT), emptyMap(), + new DiscoveryNode("node_0", DummyTransportAddress.INSTANCE, emptyMap(), emptySet(), Version.CURRENT), Settings.EMPTY, DummyOsInfo.INSTANCE, new ProcessInfo(randomInt(), randomBoolean()), JvmInfo.jvmInfo(), new ThreadPoolInfo(Collections.singletonList(new ThreadPool.Info("test_threadpool", ThreadPool.ThreadPoolType.FIXED, 5))), new TransportInfo(transportAddress, Collections.emptyMap()), new HttpInfo(transportAddress, randomLong()), diff --git a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/notification/NotificationModule.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/notification/NotificationModule.java index fbf69dfd65a..b8777192ffc 100644 --- a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/notification/NotificationModule.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/notification/NotificationModule.java @@ -41,7 +41,6 @@ public class NotificationModule extends AbstractModule { @Override protected void configure() { // email - bind(HtmlSanitizer.class).asEagerSingleton(); bind(InternalEmailService.class).asEagerSingleton(); bind(EmailService.class).to(InternalEmailService.class).asEagerSingleton(); diff --git a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/notification/email/HtmlSanitizer.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/notification/email/HtmlSanitizer.java index 7cc8f514ebc..b47f564dcd2 100644 --- a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/notification/email/HtmlSanitizer.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/notification/email/HtmlSanitizer.java @@ -41,8 +41,7 @@ public class HtmlSanitizer { private final boolean enabled; @SuppressForbidden( reason = "PolicyFactory uses guava Function") private final PolicyFactory policy; - - @Inject + public HtmlSanitizer(Settings settings) { enabled = settings.getAsBoolean("xpack.notification.email.html.sanitization.enabled", true); String[] allow = settings.getAsArray("xpack.notification.email.html.sanitization.allow", DEFAULT_ALLOWED); diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/email/EmailActionFactory.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/email/EmailActionFactory.java index 0bba29dc10c..6c974e14c43 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/email/EmailActionFactory.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/email/EmailActionFactory.java @@ -28,12 +28,12 @@ public class EmailActionFactory extends ActionFactory