Skip to content

Commit f0729fb

Browse files
authored
Merge pull request #47482 from holly-cummins/diagnostics-for-null-system-properties
Improve diagnostic output for null system properties
2 parents 14d9b57 + 1b29afe commit f0729fb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test-framework/common/src/main/java/io/quarkus/test/common/RestorableSystemProperties.java

+10
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ public static RestorableSystemProperties setProperties(Map<String, String> props
2020
sysPropRestore.put(i.getKey(), System.getProperty(i.getKey()));
2121
}
2222
for (Map.Entry<String, String> i : props.entrySet()) {
23+
if (i.getKey() == null) {
24+
throw new IllegalArgumentException(
25+
String.format("Internal error: Cannot set null key as a system property (value is %s)",
26+
i.getValue()));
27+
}
28+
if (i.getValue() == null) {
29+
throw new IllegalArgumentException(
30+
String.format("Internal error: Cannot use null value as a system property (key is %s)",
31+
i.getKey()));
32+
}
2333
System.setProperty(i.getKey(), i.getValue());
2434
}
2535
return new RestorableSystemProperties(sysPropRestore);

0 commit comments

Comments
 (0)