isaric commented on code in PR #4463:
URL: https://github.com/apache/solr/pull/4463#discussion_r3367289320
##########
solr/core/src/java/org/apache/solr/handler/SolrConfigHandler.java:
##########
@@ -356,7 +367,7 @@ private Map<String, Object>
expandUseParams(SolrQueryRequest req, Object plugin)
if (plugin instanceof Map) {
pluginInfo = (Map) plugin;
} else if (plugin instanceof PluginInfo) {
- pluginInfo = ((PluginInfo) plugin).toMap(new LinkedHashMap<>());
+ pluginInfo = new SimpleOrderedMap<>((PluginInfo) plugin);
Review Comment:
`SimpleOrderedMap` implements `Map<String, T>`, so the type is compatible.
This line was reverted to `.toMap(new LinkedHashMap<>())` because `PluginInfo`
does not implement `MapWriter` until Part 2.
##########
solr/core/src/java/org/apache/solr/handler/SolrConfigHandler.java:
##########
@@ -320,10 +323,18 @@ private void handleGET() {
}
}
+ @SuppressWarnings({"unchecked"})
+ private Map<String, Object> getComponentInfo(
+ Map<String, Object> pluginInfo, String componentName) {
+ return pluginInfo.containsKey("class")
+ ? pluginInfo
+ : (Map<String, Object>) pluginInfo.getOrDefault(componentName, new
HashMap<>());
Review Comment:
No `getOrDefault` remains in the file — the current code uses
`computeIfAbsent`, which stores the new map back into the parent and avoids the
ephemeral-map issue you describe.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]