olamy commented on code in PR #3592:
URL: https://github.com/apache/maven-surefire/pull/3592#discussion_r4561331090
##########
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java:
##########
@@ -3532,8 +3532,23 @@ public Map<String, String> getSystemPropertyVariables() {
}
@SuppressWarnings("UnusedDeclaration")
- public void setSystemPropertyVariables(Map<String, String>
systemPropertyVariables) {
- this.systemPropertyVariables = systemPropertyVariables;
+ public void setSystemPropertyVariables(Map<String, ?>
systemPropertyVariables) {
+ this.systemPropertyVariables =
+ systemPropertyVariables == null ? null :
stringifyValues(systemPropertyVariables);
+ }
+
+ /**
+ * Interpolation of a {@code systemPropertyVariables} entry such as {@code
${settings.offline}} can resolve
+ * to a non-String object (e.g. {@code Boolean}), so the configurator must
accept {@code Map<String, ?>}
+ * rather than {@code Map<String, String>} and this method stringifies
every value explicitly.
+ */
+ private static Map<String, String> stringifyValues(Map<String, ?> values) {
+ Map<String, String> result = new HashMap<>();
+ for (Entry<String, ?> entry : values.entrySet()) {
+ Object value = entry.getValue();
+ result.put(entry.getKey(), value == null ? null :
String.valueOf(value));
+ }
+ return result;
Review Comment:
well we are here with system properties so order doesn't matter at all
--
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]