Skip to content

Commit 77ed72c

Browse files
committed
Prevent initializing same system property to different values
1 parent a28a367 commit 77ed72c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SystemPropertiesSupport.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040

4141
import com.oracle.svm.core.VM;
4242
import com.oracle.svm.core.config.ConfigurationValues;
43+
import com.oracle.svm.core.util.UserError;
4344
import com.oracle.svm.core.util.VMError;
4445

4546
/**
@@ -202,7 +203,10 @@ public void setProperties(Properties props) {
202203
*/
203204
@Override
204205
public void initializeProperty(String key, String value) {
205-
savedProperties.put(key, value);
206+
String prevValue = savedProperties.put(key, value);
207+
if (prevValue != null && prevValue != value) {
208+
UserError.abort("System property %s is initialized to %s but was previously initialized to %s.", key, value, prevValue);
209+
}
206210
properties.setProperty(key, value);
207211
}
208212

0 commit comments

Comments
 (0)