Skip to content

Commit

Permalink
fixing input validation in segments and delete pit request
Browse files Browse the repository at this point in the history
Signed-off-by: Bharathwaj G <[email protected]>
  • Loading branch information
bharath-techie committed Mar 13, 2023
1 parent c2388b5 commit 9f48a02
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Fix 'org.apache.hc.core5.http.ParseException: Invalid protocol version' under JDK 16+ ([#4827](https://github.com/opensearch-project/OpenSearch/pull/4827))
- Fix compression support for h2c protocol ([#4944](https://github.com/opensearch-project/OpenSearch/pull/4944))
- Support OpenSSL Provider with default Netty allocator ([#5460](https://github.com/opensearch-project/OpenSearch/pull/5460))

- Fixing input validation in segments and delete pit request ([#6645](https://github.com/opensearch-project/OpenSearch/pull/6645))
### Security

## [Unreleased 2.x]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import static org.opensearch.action.ValidateActions.addValidationError;

Expand Down Expand Up @@ -87,7 +89,7 @@ public ActionRequestValidationException validate() {
}

public void fromXContent(XContentParser parser) throws IOException {
pitIds.clear();
Set<String> pitIds = new HashSet<>();
if (parser.nextToken() != XContentParser.Token.START_OBJECT) {
throw new IllegalArgumentException("Malformed content, must start with an object");
} else {
Expand Down Expand Up @@ -117,5 +119,7 @@ public void fromXContent(XContentParser parser) throws IOException {
}
}
}
this.pitIds.clear();
this.pitIds.addAll(pitIds);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import static org.opensearch.action.ValidateActions.addValidationError;

Expand Down Expand Up @@ -91,7 +93,7 @@ public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params par
}

public void fromXContent(XContentParser parser) throws IOException {
pitIds.clear();
Set<String> pitIds = new HashSet<>();
if (parser.nextToken() != XContentParser.Token.START_OBJECT) {
throw new IllegalArgumentException("Malformed content, must start with an object");
} else {
Expand Down Expand Up @@ -121,6 +123,8 @@ public void fromXContent(XContentParser parser) throws IOException {
}
}
}
this.pitIds.clear();
this.pitIds.addAll(pitIds);
}

}

0 comments on commit 9f48a02

Please sign in to comment.