Skip to content

Commit

Permalink
Fix passing wrong parameter when calling newConfigurationException() …
Browse files Browse the repository at this point in the history
…in DotExpanderProcessor

Signed-off-by: Gao Binlong <gbinlong@amazon.com>
  • Loading branch information
gaobinlong committed Oct 19, 2023
1 parent a3c1d50 commit d43a71b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Fix class_cast_exception when passing int to _version and other metadata fields in ingest simulate API ([#10101](https://github.com/opensearch-project/OpenSearch/pull/10101))
- Fix Segment Replication ShardLockObtainFailedException bug during index corruption ([10370](https://github.com/opensearch-project/OpenSearch/pull/10370))
- Fix some test methods in SimulatePipelineRequestParsingTests never run and fix test failure ([#10496](https://github.com/opensearch-project/OpenSearch/pull/10496))
- Fix passing wrong parameter when calling newConfigurationException() in DotExpanderProcessor

### Security

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,25 +118,15 @@ public Processor create(
) throws Exception {
String field = ConfigurationUtils.readStringProperty(TYPE, tag, config, "field");
if (field.contains(".") == false) {
throw ConfigurationUtils.newConfigurationException(
ConfigurationUtils.TAG_KEY,
tag,
"field",
"field does not contain a dot"
);
throw ConfigurationUtils.newConfigurationException(TYPE, tag, "field", "field does not contain a dot");
}
if (field.indexOf('.') == 0 || field.lastIndexOf('.') == field.length() - 1) {
throw ConfigurationUtils.newConfigurationException(
ConfigurationUtils.TAG_KEY,
tag,
"field",
"Field can't start or end with a dot"
);
throw ConfigurationUtils.newConfigurationException(TYPE, tag, "field", "Field can't start or end with a dot");
}
int firstIndex = -1;
for (int index = field.indexOf('.'); index != -1; index = field.indexOf('.', index + 1)) {
if (index - firstIndex == 1) {
throw ConfigurationUtils.newConfigurationException(ConfigurationUtils.TAG_KEY, tag, "field", "No space between dots");
throw ConfigurationUtils.newConfigurationException(TYPE, tag, "field", "No space between dots");
}
firstIndex = index;
}
Expand Down

0 comments on commit d43a71b

Please sign in to comment.