Unverified 提交 7ce8cc98 authored 作者: Турбанов Андрей's avatar Турбанов Андрей 提交者: GitHub

No need to create garbage if settings have value

上级 326e5833
...@@ -64,6 +64,10 @@ public class SettingsBase { ...@@ -64,6 +64,10 @@ public class SettingsBase {
* @return the setting * @return the setting
*/ */
protected String get(String key, String defaultValue) { protected String get(String key, String defaultValue) {
String v = settings.get(key);
if (v != null) {
return v;
}
StringBuilder buff = new StringBuilder("h2."); StringBuilder buff = new StringBuilder("h2.");
boolean nextUpper = false; boolean nextUpper = false;
for (char c : key.toCharArray()) { for (char c : key.toCharArray()) {
...@@ -76,11 +80,8 @@ public class SettingsBase { ...@@ -76,11 +80,8 @@ public class SettingsBase {
} }
} }
String sysProperty = buff.toString(); String sysProperty = buff.toString();
String v = settings.get(key);
if (v == null) {
v = Utils.getProperty(sysProperty, defaultValue); v = Utils.getProperty(sysProperty, defaultValue);
settings.put(key, v); settings.put(key, v);
}
return v; return v;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论