Settings loader local variables can be final
This commit is contained in:
parent
ad5438a6a9
commit
f522fa1df3
|
@ -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 [{}]",
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue