Commit 2f3053d
authored
Fix NPE in deprecation API (#121263)
**Reproduction path**
1. Create an composable index template that does not have a `template` section.
2. Set some settings in `deprecation.skip_deprecated_settings`
3. Run the deprecation API `GET _migration/deprecations?error_trace`
4. **Result:** we receive an error `500` with the following error and stack trace:
```
....
"reason": "Cannot invoke \"org.elasticsearch.cluster.metadata.Template.settings()\" because \"template\" is null",
"stack_trace": "java.lang.NullPointerException: Cannot invoke \"org.elasticsearch.cluster.metadata.Template.settings()\" because \"template\" is null
org.elasticsearch.xpack.deprecation.DeprecationInfoAction.lambda$removeSkippedSettings$9(DeprecationInfoAction.java:408)
....
```
**Fix** There was a typo when we were performing the null-check, we used
`templateName` instead of `template`. In this PR we fix this and we
extend the current test to capture this case as well.
The bug is not released so it's marked as a non-issue.1 parent f211838 commit 2f3053d
File tree
2 files changed
+15
-4
lines changed- x-pack/plugin/deprecation/src
- main/java/org/elasticsearch/xpack/deprecation
- test/java/org/elasticsearch/xpack/deprecation
2 files changed
+15
-4
lines changedLines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
356 | | - | |
| 356 | + | |
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
408 | | - | |
| 408 | + | |
409 | 409 | | |
410 | 410 | | |
411 | 411 | | |
| |||
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
365 | | - | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
366 | 373 | | |
367 | 374 | | |
368 | 375 | | |
| |||
391 | 398 | | |
392 | 399 | | |
393 | 400 | | |
394 | | - | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
395 | 406 | | |
396 | 407 | | |
397 | 408 | | |
| |||
0 commit comments