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 {
@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 [{}]",

View File

@ -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();

View File

@ -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));
}

View File

@ -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();