mirror of https://github.com/apache/druid.git
Adding forbidden api for Properties#get() and Properties#getOrDefault() (#13882)
Properties#getOrDefault method does not check the default map for values where as Properties#getProperty() does.
This commit is contained in:
parent
f33898ed6d
commit
65c3954942
|
@ -41,6 +41,8 @@ java.util.HashSet#<init>(int, float) @ Use com.google.collect.Sets#newHashSetWit
|
|||
java.util.LinkedHashSet#<init>(int) @ Use com.google.collect.Sets#newLinkedHashSatWithExpectedSize(int) instead
|
||||
java.util.LinkedHashSet#<init>(int, float) @ Use com.google.collect.Sets#newLinkedHashSatWithExpectedSize(int) instead
|
||||
java.util.LinkedList @ Use ArrayList or ArrayDeque instead
|
||||
java.util.Properties#get(java.lang.Object) @ Properties#get method does not check the default map for values. Use Properties#getProperty() instead.
|
||||
java.util.Properties#getOrDefault(java.lang.Object,java.lang.Object) @ Properties#getOrDefault method does not check the default map for values. Use Properties#getProperty() instead.
|
||||
java.util.Random#<init>() @ Use ThreadLocalRandom.current() or the constructor with a seed (the latter in tests only!)
|
||||
java.lang.Math#random() @ Use ThreadLocalRandom.current()
|
||||
java.util.regex.Pattern#matches(java.lang.String,java.lang.CharSequence) @ Use String.startsWith(), endsWith(), contains(), or compile and cache a Pattern explicitly
|
||||
|
|
|
@ -262,7 +262,7 @@ public class KafkaRecordSupplier implements RecordSupplier<Integer, Long, KafkaR
|
|||
|
||||
Map<String, Object> configs = new HashMap<>();
|
||||
for (String key : properties.stringPropertyNames()) {
|
||||
configs.put(key, properties.get(key));
|
||||
configs.put(key, properties.getProperty(key));
|
||||
}
|
||||
|
||||
deserializerObject.configure(configs, isKey);
|
||||
|
|
|
@ -109,7 +109,7 @@ public class IndexerZkConfigTest
|
|||
field.getName().substring(1)
|
||||
);
|
||||
Method method = ZkPathsConfig.class.getDeclaredMethod(getter);
|
||||
Assert.assertEquals(propertyValues.get(property), method.invoke(zkPathsConfig));
|
||||
Assert.assertEquals(propertyValues.getProperty(property), method.invoke(zkPathsConfig));
|
||||
++assertions;
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public class IndexerZkConfigTest
|
|||
field.getName().substring(1)
|
||||
);
|
||||
Method method = IndexerZkConfig.class.getDeclaredMethod(getter);
|
||||
Assert.assertEquals(propertyValues.get(property), method.invoke(indexerZkConfig));
|
||||
Assert.assertEquals(propertyValues.getProperty(property), method.invoke(indexerZkConfig));
|
||||
++assertions;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public final class JsonConfigTesterBaseTest
|
|||
Assert.assertEquals("[]", testProperties.getProperty("druid.test.prefix.set"));
|
||||
Assert.assertEquals("{}", testProperties.getProperty("druid.test.prefix.map"));
|
||||
for (Map.Entry entry : System.getProperties().entrySet()) {
|
||||
Assert.assertEquals(entry.getValue(), testProperties.get(entry.getKey()));
|
||||
Assert.assertEquals(entry.getValue(), testProperties.getProperty(String.valueOf(entry.getKey())));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,9 +35,9 @@ public class Log4JShutdownPropertyCheckerTest
|
|||
|
||||
Assert.assertEquals(
|
||||
"org.apache.druid.common.config.Log4jShutdown",
|
||||
properties.get("log4j.shutdownCallbackRegistry")
|
||||
properties.getProperty("log4j.shutdownCallbackRegistry")
|
||||
);
|
||||
Assert.assertEquals("true", properties.get("log4j.shutdownHookEnabled"));
|
||||
Assert.assertEquals("false", properties.get("log4j2.is.webapp"));
|
||||
Assert.assertEquals("true", properties.getProperty("log4j.shutdownHookEnabled"));
|
||||
Assert.assertEquals("false", properties.getProperty("log4j2.is.webapp"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue