Settings loader local variables can be final

This commit is contained in:
Jason Tedor 2016-03-24 10:25:46 -04:00
parent ad5438a6a9
commit f522fa1df3
4 changed files with 6 additions and 6 deletions

View File

@ -73,7 +73,7 @@ public class PropertiesSettingsLoader implements SettingsLoader {
class NoDuplicatesProperties extends Properties { class NoDuplicatesProperties extends Properties {
@Override @Override
public synchronized Object put(Object key, Object value) { public synchronized Object put(Object key, Object value) {
Object previousValue = super.put(key, value); final Object previousValue = super.put(key, value);
if (previousValue != null) { if (previousValue != null) {
throw new ElasticsearchParseException( throw new ElasticsearchParseException(
"duplicate settings key [{}] found, previous value [{}], current value [{}]", "duplicate settings key [{}] found, previous value [{}], current value [{}]",

View File

@ -31,8 +31,8 @@ import static org.hamcrest.Matchers.equalTo;
public class JsonSettingsLoaderTests extends ESTestCase { public class JsonSettingsLoaderTests extends ESTestCase {
public void testSimpleJsonSettings() throws Exception { public void testSimpleJsonSettings() throws Exception {
String json = "/org/elasticsearch/common/settings/loader/test-settings.json"; final String json = "/org/elasticsearch/common/settings/loader/test-settings.json";
Settings settings = settingsBuilder() final Settings settings = settingsBuilder()
.loadFromStream(json, getClass().getResourceAsStream(json)) .loadFromStream(json, getClass().getResourceAsStream(json))
.build(); .build();

View File

@ -50,7 +50,7 @@ public class PropertiesSettingsLoaderTests extends ESTestCase {
} }
public void testThatNoDuplicatesPropertiesDoesNotAcceptNullValues() { public void testThatNoDuplicatesPropertiesDoesNotAcceptNullValues() {
PropertiesSettingsLoader.NoDuplicatesProperties properties = loader.new NoDuplicatesProperties(); final PropertiesSettingsLoader.NoDuplicatesProperties properties = loader.new NoDuplicatesProperties();
expectThrows(NullPointerException.class, () -> properties.put("key", null)); expectThrows(NullPointerException.class, () -> properties.put("key", null));
} }

View File

@ -31,8 +31,8 @@ import static org.hamcrest.Matchers.equalTo;
public class YamlSettingsLoaderTests extends ESTestCase { public class YamlSettingsLoaderTests extends ESTestCase {
public void testSimpleYamlSettings() throws Exception { public void testSimpleYamlSettings() throws Exception {
String yaml = "/org/elasticsearch/common/settings/loader/test-settings.yml"; final String yaml = "/org/elasticsearch/common/settings/loader/test-settings.yml";
Settings settings = settingsBuilder() final Settings settings = settingsBuilder()
.loadFromStream(yaml, getClass().getResourceAsStream(yaml)) .loadFromStream(yaml, getClass().getResourceAsStream(yaml))
.build(); .build();