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:
parent
d6f27409a6
commit
cfa3a0fd59
@ -87,11 +87,9 @@ public class AuthConfigs extends Subscriber<ServerConfigChangeEvent> {
|
|||||||
for (String each : properties.stringPropertyNames()) {
|
for (String each : properties.stringPropertyNames()) {
|
||||||
int typeIndex = each.indexOf('.');
|
int typeIndex = each.indexOf('.');
|
||||||
String type = each.substring(0, typeIndex);
|
String type = each.substring(0, typeIndex);
|
||||||
if (!newProperties.containsKey(type)) {
|
|
||||||
newProperties.put(type, new Properties());
|
|
||||||
}
|
|
||||||
String subKey = each.substring(typeIndex + 1);
|
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;
|
authPluginProperties = newProperties;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user