315157973 commented on code in PR #20713:
URL: https://github.com/apache/pulsar/pull/20713#discussion_r1251973648
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfigurationUtils.java:
##########
@@ -137,4 +137,18 @@ public static String webServiceUrl(String host, int port) {
public static String webServiceUrlTls(String host, int port) {
return String.format("https://%s:%d", host, port);
}
+
+ public static long getLongPropertyOrDefault(ServiceConfiguration config,
String key, long defaultValue) {
+ Object value = config.getProperties().get(key);
+ if (value instanceof Integer) {
+ return (Long) value;
+ } else if (value instanceof String) {
+ try {
+ return Long.parseLong((String) value);
+ } catch (NumberFormatException e) {
+ return defaultValue;
+ }
+ }
+ return defaultValue;
+ }
Review Comment:
In unit test line 326, I already set an Integer value. It looks OK. I'm not
sure whether to add another test
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]