Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix null_pointer_exception when creating or updating ingest pipeline #9259

Merged
merged 7 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

### Fixed
- Fix flaky ResourceAwareTasksTests.testBasicTaskResourceTracking test ([#8993](https://github.com/opensearch-project/OpenSearch/pull/8993))
- Fix null_pointer_exception when creating or updating ingest pipeline ([#9259](https://github.com/opensearch-project/OpenSearch/pull/9259))

### Security

[Unreleased 3.0]: https://github.com/opensearch-project/OpenSearch/compare/2.x...HEAD
[Unreleased 2.x]: https://github.com/opensearch-project/OpenSearch/compare/2.10...2.x
[Unreleased 2.x]: https://github.com/opensearch-project/OpenSearch/compare/2.10...2.x
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,9 @@ public static Processor readProcessor(
String type,
Object config
gaobinlong marked this conversation as resolved.
Show resolved Hide resolved
) throws Exception {
if (config instanceof Map) {
if (config == null) {
reta marked this conversation as resolved.
Show resolved Hide resolved
throw newConfigurationException(type, null, null, "processor [" + type + "] cannot be null");
gaobinlong marked this conversation as resolved.
Show resolved Hide resolved
} else if (config instanceof Map) {
return readProcessor(processorFactories, scriptService, type, (Map<String, Object>) config);
} else if (config instanceof String && "script".equals(type)) {
Map<String, Object> normalizedScript = new HashMap<>(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ public void testReadProcessors() throws Exception {
assertThat(e2.getMetadata("opensearch.processor_tag"), equalTo(Collections.singletonList("my_second_unknown")));
assertThat(e2.getMetadata("opensearch.processor_type"), equalTo(Collections.singletonList("second_unknown_processor")));
assertThat(e2.getMetadata("opensearch.property_name"), is(nullValue()));

// test null config
List<Map<String, Object>> config3 = new ArrayList<>();
config3.add(Collections.singletonMap("null_processor", null));

OpenSearchParseException ex = expectThrows(
OpenSearchParseException.class,
() -> ConfigurationUtils.readProcessorConfigs(config3, scriptService, registry)
);
assertEquals(ex.getMessage(), "processor [null_processor] cannot be null");
}

public void testReadProcessorNullDescription() throws Exception {
Expand Down
Loading