From f522fa1df315374883a9a666b6798f751abb7e18 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Thu, 24 Mar 2016 10:25:46 -0400 Subject: [PATCH] Settings loader local variables can be final --- .../common/settings/loader/PropertiesSettingsLoader.java | 2 +- .../common/settings/loader/JsonSettingsLoaderTests.java | 4 ++-- .../common/settings/loader/PropertiesSettingsLoaderTests.java | 2 +- .../common/settings/loader/YamlSettingsLoaderTests.java | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/common/settings/loader/PropertiesSettingsLoader.java b/core/src/main/java/org/elasticsearch/common/settings/loader/PropertiesSettingsLoader.java index 6d3e87d03fa..6ee1f58cf4b 100644 --- a/core/src/main/java/org/elasticsearch/common/settings/loader/PropertiesSettingsLoader.java +++ b/core/src/main/java/org/elasticsearch/common/settings/loader/PropertiesSettingsLoader.java @@ -73,7 +73,7 @@ public class PropertiesSettingsLoader implements SettingsLoader { class NoDuplicatesProperties extends Properties { @Override public synchronized Object put(Object key, Object value) { - Object previousValue = super.put(key, value); + final Object previousValue = super.put(key, value); if (previousValue != null) { throw new ElasticsearchParseException( "duplicate settings key [{}] found, previous value [{}], current value [{}]", diff --git a/core/src/test/java/org/elasticsearch/common/settings/loader/JsonSettingsLoaderTests.java b/core/src/test/java/org/elasticsearch/common/settings/loader/JsonSettingsLoaderTests.java index fadbd2bee46..154ef8ee039 100644 --- a/core/src/test/java/org/elasticsearch/common/settings/loader/JsonSettingsLoaderTests.java +++ b/core/src/test/java/org/elasticsearch/common/settings/loader/JsonSettingsLoaderTests.java @@ -31,8 +31,8 @@ import static org.hamcrest.Matchers.equalTo; public class JsonSettingsLoaderTests extends ESTestCase { public void testSimpleJsonSettings() throws Exception { - String json = "/org/elasticsearch/common/settings/loader/test-settings.json"; - Settings settings = settingsBuilder() + final String json = "/org/elasticsearch/common/settings/loader/test-settings.json"; + final Settings settings = settingsBuilder() .loadFromStream(json, getClass().getResourceAsStream(json)) .build(); diff --git a/core/src/test/java/org/elasticsearch/common/settings/loader/PropertiesSettingsLoaderTests.java b/core/src/test/java/org/elasticsearch/common/settings/loader/PropertiesSettingsLoaderTests.java index ab96f763a88..c13ae7cc68b 100644 --- a/core/src/test/java/org/elasticsearch/common/settings/loader/PropertiesSettingsLoaderTests.java +++ b/core/src/test/java/org/elasticsearch/common/settings/loader/PropertiesSettingsLoaderTests.java @@ -50,7 +50,7 @@ public class PropertiesSettingsLoaderTests extends ESTestCase { } public void testThatNoDuplicatesPropertiesDoesNotAcceptNullValues() { - PropertiesSettingsLoader.NoDuplicatesProperties properties = loader.new NoDuplicatesProperties(); + final PropertiesSettingsLoader.NoDuplicatesProperties properties = loader.new NoDuplicatesProperties(); expectThrows(NullPointerException.class, () -> properties.put("key", null)); } diff --git a/core/src/test/java/org/elasticsearch/common/settings/loader/YamlSettingsLoaderTests.java b/core/src/test/java/org/elasticsearch/common/settings/loader/YamlSettingsLoaderTests.java index 62350f55023..2e2a187da0b 100644 --- a/core/src/test/java/org/elasticsearch/common/settings/loader/YamlSettingsLoaderTests.java +++ b/core/src/test/java/org/elasticsearch/common/settings/loader/YamlSettingsLoaderTests.java @@ -31,8 +31,8 @@ import static org.hamcrest.Matchers.equalTo; public class YamlSettingsLoaderTests extends ESTestCase { public void testSimpleYamlSettings() throws Exception { - String yaml = "/org/elasticsearch/common/settings/loader/test-settings.yml"; - Settings settings = settingsBuilder() + final String yaml = "/org/elasticsearch/common/settings/loader/test-settings.yml"; + final Settings settings = settingsBuilder() .loadFromStream(yaml, getClass().getResourceAsStream(yaml)) .build();