Skip to content

Commit 0e6d972

Browse files
committed
Avoid setting null system properties in Mojos
Empty values injected by @parameter in a Map are going to be null. We should avoid trying to push these values to the system properties as they are ultimately backed by a CHM, which doesn't support null values. Fixes #47446
1 parent 728ff8c commit 0e6d972

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java

+4
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ protected void doExecute() throws MojoExecutionException {
114114
// Add the system properties of the plugin to the system properties
115115
// if and only if they are not already set.
116116
for (Map.Entry<String, String> entry : systemProperties.entrySet()) {
117+
if (entry.getValue() == null) {
118+
continue;
119+
}
120+
117121
String key = entry.getKey();
118122
if (System.getProperty(key) == null) {
119123
System.setProperty(key, entry.getValue());

devtools/maven/src/main/java/io/quarkus/maven/RunMojo.java

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ protected void doExecute() throws MojoExecutionException, MojoFailureException {
4343
// Add the system properties of the plugin to the system properties
4444
// if and only if they are not already set.
4545
for (Map.Entry<String, String> entry : systemProperties.entrySet()) {
46+
if (entry.getValue() == null) {
47+
continue;
48+
}
49+
4650
String key = entry.getKey();
4751
if (System.getProperty(key) == null) {
4852
System.setProperty(key, entry.getValue());

0 commit comments

Comments
 (0)