Skip to content

Commit 22adbd3

Browse files
committed
Modify comments
Signed-off-by: Xue Zhou <[email protected]>
1 parent 030619b commit 22adbd3

File tree

4 files changed

+25
-24
lines changed

4 files changed

+25
-24
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
7575
- Change http code for DecommissioningFailedException from 500 to 400 ([#5283](https://github.com/opensearch-project/OpenSearch/pull/5283))
7676
- Pre conditions check before updating weighted routing metadata ([#4955](https://github.com/opensearch-project/OpenSearch/pull/4955))
7777
- Gracefully handle concurrent zone decommission action ([#5542](https://github.com/opensearch-project/OpenSearch/pull/5542))
78+
- Mapping IllegalArgumentException to SettingsException extend OpenSearchException in AbstractScopedSettings class ([#4792](https://github.com/opensearch-project/OpenSearch/pull/4792))
7879

7980
### Deprecated
8081

server/src/internalClusterTest/java/org/opensearch/indices/settings/UpdateSettingsIT.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -175,27 +175,27 @@ protected Settings nodeSettings(int nodeOrdinal) {
175175
}
176176

177177
public void testUpdateDependentClusterSettings() {
178-
SettingsException iae = expectThrows(
178+
SettingsException e = expectThrows(
179179
SettingsException.class,
180180
() -> client().admin()
181181
.cluster()
182182
.prepareUpdateSettings()
183183
.setPersistentSettings(Settings.builder().put("cluster.acc.test.pw", "asdf"))
184184
.get()
185185
);
186-
assertEquals("missing required setting [cluster.acc.test.user] for setting [cluster.acc.test.pw]", iae.getMessage());
186+
assertEquals("missing required setting [cluster.acc.test.user] for setting [cluster.acc.test.pw]", e.getMessage());
187187

188-
iae = expectThrows(
188+
e = expectThrows(
189189
SettingsException.class,
190190
() -> client().admin()
191191
.cluster()
192192
.prepareUpdateSettings()
193193
.setTransientSettings(Settings.builder().put("cluster.acc.test.pw", "asdf"))
194194
.get()
195195
);
196-
assertEquals("missing required setting [cluster.acc.test.user] for setting [cluster.acc.test.pw]", iae.getMessage());
196+
assertEquals("missing required setting [cluster.acc.test.user] for setting [cluster.acc.test.pw]", e.getMessage());
197197

198-
iae = expectThrows(
198+
e = expectThrows(
199199
SettingsException.class,
200200
() -> client().admin()
201201
.cluster()
@@ -204,23 +204,23 @@ public void testUpdateDependentClusterSettings() {
204204
.setPersistentSettings(Settings.builder().put("cluster.acc.test.user", "asdf"))
205205
.get()
206206
);
207-
assertEquals("missing required setting [cluster.acc.test.user] for setting [cluster.acc.test.pw]", iae.getMessage());
207+
assertEquals("missing required setting [cluster.acc.test.user] for setting [cluster.acc.test.pw]", e.getMessage());
208208

209209
if (randomBoolean()) {
210210
client().admin()
211211
.cluster()
212212
.prepareUpdateSettings()
213213
.setTransientSettings(Settings.builder().put("cluster.acc.test.pw", "asdf").put("cluster.acc.test.user", "asdf"))
214214
.get();
215-
iae = expectThrows(
215+
e = expectThrows(
216216
SettingsException.class,
217217
() -> client().admin()
218218
.cluster()
219219
.prepareUpdateSettings()
220220
.setTransientSettings(Settings.builder().putNull("cluster.acc.test.user"))
221221
.get()
222222
);
223-
assertEquals("missing required setting [cluster.acc.test.user] for setting [cluster.acc.test.pw]", iae.getMessage());
223+
assertEquals("missing required setting [cluster.acc.test.user] for setting [cluster.acc.test.pw]", e.getMessage());
224224
client().admin()
225225
.cluster()
226226
.prepareUpdateSettings()
@@ -233,15 +233,15 @@ public void testUpdateDependentClusterSettings() {
233233
.setPersistentSettings(Settings.builder().put("cluster.acc.test.pw", "asdf").put("cluster.acc.test.user", "asdf"))
234234
.get();
235235

236-
iae = expectThrows(
236+
e = expectThrows(
237237
SettingsException.class,
238238
() -> client().admin()
239239
.cluster()
240240
.prepareUpdateSettings()
241241
.setPersistentSettings(Settings.builder().putNull("cluster.acc.test.user"))
242242
.get()
243243
);
244-
assertEquals("missing required setting [cluster.acc.test.user] for setting [cluster.acc.test.pw]", iae.getMessage());
244+
assertEquals("missing required setting [cluster.acc.test.user] for setting [cluster.acc.test.pw]", e.getMessage());
245245

246246
client().admin()
247247
.cluster()
@@ -253,11 +253,11 @@ public void testUpdateDependentClusterSettings() {
253253
}
254254

255255
public void testUpdateDependentIndexSettings() {
256-
SettingsException iae = expectThrows(
256+
SettingsException e = expectThrows(
257257
SettingsException.class,
258258
() -> prepareCreate("test", Settings.builder().put("index.acc.test.pw", "asdf")).get()
259259
);
260-
assertEquals("missing required setting [index.acc.test.user] for setting [index.acc.test.pw]", iae.getMessage());
260+
assertEquals("missing required setting [index.acc.test.user] for setting [index.acc.test.pw]", e.getMessage());
261261

262262
createIndex("test");
263263
for (int i = 0; i < 2; i++) {
@@ -266,7 +266,7 @@ public void testUpdateDependentIndexSettings() {
266266
client().admin().indices().prepareClose("test").get();
267267
}
268268

269-
iae = expectThrows(
269+
e = expectThrows(
270270
SettingsException.class,
271271
() -> client().admin()
272272
.indices()
@@ -275,7 +275,7 @@ public void testUpdateDependentIndexSettings() {
275275
.execute()
276276
.actionGet()
277277
);
278-
assertEquals("missing required setting [index.acc.test.user] for setting [index.acc.test.pw]", iae.getMessage());
278+
assertEquals("missing required setting [index.acc.test.user] for setting [index.acc.test.pw]", e.getMessage());
279279

280280
// user has no dependency
281281
client().admin()
@@ -294,7 +294,7 @@ public void testUpdateDependentIndexSettings() {
294294
.actionGet();
295295

296296
// now try to remove it and make sure it fails
297-
iae = expectThrows(
297+
e = expectThrows(
298298
SettingsException.class,
299299
() -> client().admin()
300300
.indices()
@@ -303,7 +303,7 @@ public void testUpdateDependentIndexSettings() {
303303
.execute()
304304
.actionGet()
305305
);
306-
assertEquals("missing required setting [index.acc.test.user] for setting [index.acc.test.pw]", iae.getMessage());
306+
assertEquals("missing required setting [index.acc.test.user] for setting [index.acc.test.pw]", e.getMessage());
307307

308308
// now we are consistent
309309
client().admin()

server/src/test/java/org/opensearch/common/settings/ScopedSettingsTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ public void testDependentSettings() {
208208

209209
AbstractScopedSettings service = new ClusterSettings(Settings.EMPTY, new HashSet<>(Arrays.asList(intSetting, stringSetting)));
210210

211-
SettingsException iae = expectThrows(
211+
SettingsException e = expectThrows(
212212
SettingsException.class,
213213
() -> service.validate(Settings.builder().put("foo.test.bar", 7).build(), true)
214214
);
215-
assertEquals("missing required setting [foo.test.name] for setting [foo.test.bar]", iae.getMessage());
215+
assertEquals("missing required setting [foo.test.name] for setting [foo.test.bar]", e.getMessage());
216216

217217
service.validate(Settings.builder().put("foo.test.name", "test").put("foo.test.bar", 7).build(), true);
218218

@@ -247,11 +247,11 @@ public void validate(final String key, final Object value, final Object dependen
247247

248248
AbstractScopedSettings service = new ClusterSettings(Settings.EMPTY, new HashSet<>(Arrays.asList(intSetting, stringSetting)));
249249

250-
SettingsException iae = expectThrows(
250+
SettingsException e = expectThrows(
251251
SettingsException.class,
252252
() -> service.validate(Settings.builder().put("foo.test.bar", 7).put("foo.test.name", "invalid").build(), true)
253253
);
254-
assertEquals("[foo.test.bar] is set but [name] is [invalid]", iae.getMessage());
254+
assertEquals("[foo.test.bar] is set but [name] is [invalid]", e.getMessage());
255255

256256
service.validate(Settings.builder().put("foo.test.bar", 7).put("foo.test.name", "valid").build(), true);
257257

@@ -963,11 +963,11 @@ public void testGetSetting() {
963963

964964
public void testValidateWithSuggestion() {
965965
IndexScopedSettings settings = new IndexScopedSettings(Settings.EMPTY, IndexScopedSettings.BUILT_IN_INDEX_SETTINGS);
966-
SettingsException iae = expectThrows(
966+
SettingsException e = expectThrows(
967967
SettingsException.class,
968968
() -> settings.validate(Settings.builder().put("index.numbe_of_replica", "1").build(), false)
969969
);
970-
assertEquals(iae.getMessage(), "unknown setting [index.numbe_of_replica] did you mean [index.number_of_replicas]?");
970+
assertEquals(e.getMessage(), "unknown setting [index.numbe_of_replica] did you mean [index.number_of_replicas]?");
971971
}
972972

973973
public void testValidate() {

server/src/test/java/org/opensearch/search/SearchServiceTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,15 +1072,15 @@ public void testSetSearchThrottled() {
10721072
)
10731073
).actionGet();
10741074

1075-
SettingsException iae = expectThrows(
1075+
SettingsException se = expectThrows(
10761076
SettingsException.class,
10771077
() -> client().admin()
10781078
.indices()
10791079
.prepareUpdateSettings("throttled_threadpool_index")
10801080
.setSettings(Settings.builder().put(IndexSettings.INDEX_SEARCH_THROTTLED.getKey(), false))
10811081
.get()
10821082
);
1083-
assertEquals("can not update private setting [index.search.throttled]; this setting is managed by OpenSearch", iae.getMessage());
1083+
assertEquals("can not update private setting [index.search.throttled]; this setting is managed by OpenSearch", se.getMessage());
10841084
assertFalse(service.getIndicesService().indexServiceSafe(index).getIndexSettings().isSearchThrottled());
10851085
SearchRequest searchRequest = new SearchRequest().allowPartialSearchResults(false);
10861086
ShardSearchRequest req = new ShardSearchRequest(

0 commit comments

Comments
 (0)