From 4cdd593d4f1126ad033fd3da3093868fcea2e8a9 Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Thu, 19 Sep 2024 14:08:26 -0400 Subject: [PATCH] Check version when serializing Signed-off-by: Craig Perkins --- .../src/main/java/org/opensearch/plugins/PluginInfo.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/src/main/java/org/opensearch/plugins/PluginInfo.java b/server/src/main/java/org/opensearch/plugins/PluginInfo.java index 7adefb8c7b1bb..c00fe0f92933e 100644 --- a/server/src/main/java/org/opensearch/plugins/PluginInfo.java +++ b/server/src/main/java/org/opensearch/plugins/PluginInfo.java @@ -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; @@ -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); } }