gnodet-bot commented on code in PR #2354:
URL: https://github.com/apache/maven-resolver/pull/2354#discussion_r4716781040


##########
maven-resolver-util/src/main/java/org/eclipse/aether/util/ConfigUtils.java:
##########
@@ -324,20 +331,29 @@ public static List<?> getList(RepositorySystemSession 
session, List<?> defaultVa
 
             if (value instanceof Map) {
                 return (Map<?, ?>) value;
+            } else if (value instanceof String) {
+                Properties parsed = new Properties();
+                try {
+                    parsed.load(new StringReader((String) value));
+                } catch (IOException e) {
+                    throw new UncheckedIOException("Failed to parse map 
configuration value for " + key, e);
+                }
+                return parsed;

Review Comment:
   💡 **Minor: return a `HashMap` copy instead of raw `Properties`.**
   
   `Properties` extends `Hashtable<Object,Object>` — it is synchronized, 
disallows null keys/values, and has a different iteration order than `HashMap`. 
Callers like `HttpTransporterUtils.getHttpHeaders()` cast the result to 
`Map<String, String>` via unchecked cast; they'll get a `Hashtable`-backed map 
when they expected a regular `Map`. Returning `new HashMap<>(parsed)` is cheap 
and consistent with the existing map case.
   
   ```suggestion
                   Properties parsed = new Properties();
                   try {
                       parsed.load(new StringReader((String) value));
                   } catch (IOException e) {
                       throw new UncheckedIOException("Failed to parse map 
configuration value for " + key, e);
                   }
                   return new java.util.HashMap<>(parsed);
   ```



-- 
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]

Reply via email to