diff options
-rw-r--r-- | src/main/java/com/gitblit/StoredUserConfig.java | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/main/java/com/gitblit/StoredUserConfig.java b/src/main/java/com/gitblit/StoredUserConfig.java index 2161ebb2..eae1d3cf 100644 --- a/src/main/java/com/gitblit/StoredUserConfig.java +++ b/src/main/java/com/gitblit/StoredUserConfig.java @@ -1,3 +1,19 @@ +/* + * Copyright 2021 gitblit.com, Ingo Lafrenz + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.gitblit; import java.io.File; @@ -9,7 +25,6 @@ import java.util.Map; import java.util.Objects; import java.util.SortedMap; import java.util.TreeMap; -import java.util.function.Function; /** * Simple class with the only purpose to save the realm file (users.conf) in @@ -29,12 +44,12 @@ public class StoredUserConfig { } public void setString(final String section, final String subsection, String name, String value) { - Section s = sections.computeIfAbsent(generateKey(section, subsection), new Function<String, Section>() { - @Override - public Section apply(String k) { - return new Section(section, subsection); - } - }); + String key = generateKey(section, subsection); + Section s = sections.get(key); + if (s == null) { + s = new Section(section, subsection); + sections.put(key, s); + } s.addEntry(name, value); } |