Skip to content

Commit

Permalink
Check version when serializing
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <cwperx@amazon.com>
  • Loading branch information
cwperks committed Sep 19, 2024
1 parent 758b671 commit 4cdd593
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions server/src/main/java/org/opensearch/plugins/PluginInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ public PluginInfo(final StreamInput in) throws IOException {
this.customFolderName = in.readString();
this.extendedPlugins = in.readStringList();
this.hasNativeController = in.readBoolean();
if (in.getVersion().onOrAfter(Version.V_2_18_0)) {
// TODO switch this to 2.X version this change will be released in after backport
if (in.getVersion().onOrAfter(Version.CURRENT)) {
this.requestedActions = Settings.readSettingsFromStream(in);
} else {
this.requestedActions = Settings.EMPTY;
Expand Down Expand Up @@ -247,10 +248,8 @@ This works for currently supported range notations (=,~)
}
out.writeStringCollection(extendedPlugins);
out.writeBoolean(hasNativeController);
if (requestedActions != null) {
if (out.getVersion().onOrAfter(Version.CURRENT)) {
Settings.writeSettingsToStream(requestedActions, out);
} else {
Settings.writeSettingsToStream(Settings.EMPTY, out);
}
}

Expand Down

0 comments on commit 4cdd593

Please sign in to comment.