Unfiy Map's get and put methods by computeIfAbsent In AuthConfig (#8390)

* Unfiy Map's get and put methods by computeIfAbsent In AuthConfig

reformat code style

reformat code style

* reformat code style

* reformat issue
This commit is contained in:
Karson 2022-05-23 15:19:22 +08:00 committed by GitHub
parent d6f27409a6
commit cfa3a0fd59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,11 +87,9 @@ public class AuthConfigs extends Subscriber<ServerConfigChangeEvent> {
for (String each : properties.stringPropertyNames()) {
int typeIndex = each.indexOf('.');
String type = each.substring(0, typeIndex);
if (!newProperties.containsKey(type)) {
newProperties.put(type, new Properties());
}
String subKey = each.substring(typeIndex + 1);
newProperties.get(type).setProperty(subKey, properties.getProperty(each));
newProperties.computeIfAbsent(type, key -> new Properties())
.setProperty(subKey, properties.getProperty(each));
}
authPluginProperties = newProperties;
} catch (Exception e) {