@@ -50,6 +50,8 @@ public class PluginInfo implements Writeable, ToXContentObject {
50
50
public static final String ES_PLUGIN_PROPERTIES = "plugin-descriptor.properties" ;
51
51
public static final String ES_PLUGIN_POLICY = "plugin-security.policy" ;
52
52
53
+ private static final Version LICENSED_PLUGINS_SUPPORT = Version .V_6_8_14 ;
54
+
53
55
private final String name ;
54
56
private final String description ;
55
57
private final String version ;
@@ -123,11 +125,8 @@ public PluginInfo(final StreamInput in) throws IOException {
123
125
*/
124
126
in .readBoolean ();
125
127
}
126
- if (isLicensedPluginsSupported (in .getVersion ())) {
127
- isLicensed = in .readBoolean ();
128
- } else {
129
- isLicensed = false ;
130
- }
128
+ // We don't serialise `isLicensed` in 6.8
129
+ isLicensed = false ;
131
130
}
132
131
133
132
@ Override
@@ -153,31 +152,13 @@ public void writeTo(final StreamOutput out) throws IOException {
153
152
*/
154
153
out .writeBoolean (false );
155
154
}
156
- if (isLicensedPluginsSupported (out .getVersion ())) {
157
- out .writeBoolean (isLicensed );
158
- }
155
+ // We don't serialise `isLicensed` in 6.8
159
156
}
160
157
161
158
// We have to create our own Version objects for 7.x because they aren't defined in the Version class.
162
159
private static final Version V_7_0_0 = Version .fromId (7_00_00_99 );
163
160
private static final Version V_7_11_0 = Version .fromId (7_11_00_99 );
164
161
165
- /**
166
- * Checks whether licensed plugins are supported in the supplied version. Licensed plugins were
167
- * introduced late in the 6.8 and 7.x lifecycle, so it is not possible to simply check whether
168
- * the supplied version is higher than a specific version. Rather, the version could fall in
169
- * one of two possible ranges.
170
- * @param version the version to check
171
- * @return whether licensed plugins are supported in the version
172
- */
173
- private static boolean isLicensedPluginsSupported (Version version ) {
174
- if (version .onOrAfter (Version .V_6_8_14 ) && version .before (V_7_0_0 )) {
175
- return true ;
176
- }
177
-
178
- return version .onOrAfter (V_7_11_0 );
179
- }
180
-
181
162
/**
182
163
* Reads the plugin descriptor file.
183
164
*
@@ -246,7 +227,7 @@ public static PluginInfo readFromProperties(final Path path) throws IOException
246
227
}
247
228
248
229
boolean isLicensed = false ;
249
- if (isLicensedPluginsSupported ( esVersion )) {
230
+ if (esVersion . onOrAfter ( LICENSED_PLUGINS_SUPPORT )) {
250
231
isLicensed = parseBooleanValue (name , "licensed" , propsMap .remove ("licensed" ));
251
232
}
252
233
@@ -364,7 +345,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
364
345
builder .field ("classname" , classname );
365
346
builder .field ("extended_plugins" , extendedPlugins );
366
347
builder .field ("has_native_controller" , hasNativeController );
367
- builder .field ("licensed" , isLicensed );
368
348
}
369
349
builder .endObject ();
370
350
@@ -404,7 +384,6 @@ public String toString(String prefix) {
404
384
.append (prefix ).append ("Elasticsearch Version: " ).append (elasticsearchVersion ).append ("\n " )
405
385
.append (prefix ).append ("Java Version: " ).append (javaVersion ).append ("\n " )
406
386
.append (prefix ).append ("Native Controller: " ).append (hasNativeController ).append ("\n " )
407
- .append (prefix ).append ("Licensed: " ).append (isLicensed ).append ("\n " )
408
387
.append (prefix ).append ("Extended Plugins: " ).append (extendedPlugins ).append ("\n " )
409
388
.append (prefix ).append (" * Classname: " ).append (classname );
410
389
return information .toString ();
0 commit comments