Unverified 提交 7c2acb26 authored 作者: Noel Grandin's avatar Noel Grandin 提交者: GitHub

Merge pull request #677 from turbanoff/patch-1

No need to create garbage if settings have value
...@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论