From 11d787629d2f3f07b5151c3188ad04cc08eb75ec Mon Sep 17 00:00:00 2001 From: Andy Kwok Date: Wed, 27 Nov 2024 10:49:02 -0800 Subject: [PATCH] Remove custom serialisation support Signed-off-by: Andy Kwok --- .../geospatial/action/IpEnrichmentRequest.java | 9 +-------- .../geospatial/action/IpEnrichmentResponse.java | 11 +---------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/client/src/main/java/org/opensearch/geospatial/action/IpEnrichmentRequest.java b/client/src/main/java/org/opensearch/geospatial/action/IpEnrichmentRequest.java index 1f3cbe3c..c029ca13 100644 --- a/client/src/main/java/org/opensearch/geospatial/action/IpEnrichmentRequest.java +++ b/client/src/main/java/org/opensearch/geospatial/action/IpEnrichmentRequest.java @@ -31,8 +31,6 @@ @AllArgsConstructor public class IpEnrichmentRequest extends ActionRequest { - private static final String VERSION = "2.18.0.0"; - private String ipString; private String datasourceName; @@ -89,12 +87,7 @@ public static IpEnrichmentRequest fromActionRequest(ActionRequest actionRequest) try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStreamStreamOutput osso = new OutputStreamStreamOutput(baos)) { actionRequest.writeTo(osso); try (StreamInput input = new InputStreamStreamInput(new ByteArrayInputStream(baos.toByteArray()))) { - String objectVersion = input.readString(); - if (VERSION.equals(objectVersion)) { - return new IpEnrichmentRequest(input); - } else { - throw new IllegalArgumentException("Fail to serialise IpEnrichmentRequest due to version mismatch"); - } + return new IpEnrichmentRequest(input); } } catch (IOException e) { throw new UncheckedIOException("Failed to parse ActionRequest into IpEnrichmentRequest", e); diff --git a/client/src/main/java/org/opensearch/geospatial/action/IpEnrichmentResponse.java b/client/src/main/java/org/opensearch/geospatial/action/IpEnrichmentResponse.java index a1f34e55..7f5c3007 100644 --- a/client/src/main/java/org/opensearch/geospatial/action/IpEnrichmentResponse.java +++ b/client/src/main/java/org/opensearch/geospatial/action/IpEnrichmentResponse.java @@ -33,8 +33,6 @@ @EqualsAndHashCode(callSuper = false) public class IpEnrichmentResponse extends ActionResponse { - private static final String VERSION = "2.18.0.0"; - private Map geoLocationData; /** @@ -74,15 +72,8 @@ public static IpEnrichmentResponse fromActionResponse(ActionResponse actionRespo // Or else convert it try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStreamStreamOutput osso = new OutputStreamStreamOutput(baos)) { actionResponse.writeTo(osso); - - try (StreamInput input = new InputStreamStreamInput(new ByteArrayInputStream(baos.toByteArray()))) { - String objectVersion = input.readString(); - if (VERSION.equals(objectVersion)) { - return new IpEnrichmentResponse(input); - } else { - throw new IllegalArgumentException("Fail to serialise IpEnrichmentResponse due to version mismatch"); - } + return new IpEnrichmentResponse(input); } } catch (IOException e) { throw new UncheckedIOException("Failed to parse ActionResponse into IpEnrichmentResponse", e);