File tree Expand file tree Collapse file tree
src/main/java/edu/harvard/iq/dataverse/settings Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1127,10 +1127,16 @@ public JsonObjectBuilder setAllFromJson(JsonObject settings) {
11271127 // Convert JSON to Setting objects
11281128 Set <Setting > newSettings = convertJsonToSettings (settings );
11291129
1130- // Execute the update (in one atomic operation using a transaction)
1131- Map <Setting , Op > operationalDetails = replaceAllSettings (newSettings );
1130+ // Perform atomic update (replace all settings)
1131+ // We don't allow to completely wipe all settings coming from JSON here, so no acciddents happen.
1132+ // (It's completely unrealistic someone would try to remove all settings and leave it at that.)
1133+ if (newSettings != null && !newSettings .isEmpty ()) {
1134+ // Execute the update (in one atomic operation using a transaction)
1135+ Map <Setting , Op > operationalDetails = replaceAllSettings (newSettings );
11321136
1133- return Op .convertToJson (operationalDetails );
1137+ return Op .convertToJson (operationalDetails );
1138+ }
1139+ throw new IllegalArgumentException ("Settings cannot be empty - you'd wipe the entire configuration." );
11341140 }
11351141
11361142 /**
You can’t perform that action at this time.
0 commit comments