From cdd1956742ab26b7db5e47f2821ae9f79669a485 Mon Sep 17 00:00:00 2001 From: Dan Cecoi Date: Wed, 7 Aug 2024 15:44:20 +0100 Subject: [PATCH 1/3] Removed the null constraints on NodeInfo.host, NodeInfo.Ip, NodeInfo.TransportAddress Signed-off-by: Dan Cecoi --- .../client/opensearch/nodes/info/NodeInfo.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfo.java b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfo.java index 94df6b761c..ea9f2ef1a7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfo.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfo.java @@ -60,11 +60,13 @@ public class NodeInfo implements PlainJsonSerializable { private final String buildType; + @Nullable private final String host; @Nullable private final NodeInfoHttp http; + @Nullable private final String ip; @Nullable @@ -99,6 +101,7 @@ public class NodeInfo implements PlainJsonSerializable { @Nullable private final NodeInfoTransport transport; + @Nullable private final String transportAddress; private final String version; @@ -117,9 +120,9 @@ private NodeInfo(Builder builder) { this.attributes = ApiTypeHelper.unmodifiable(builder.attributes); this.buildHash = ApiTypeHelper.requireNonNull(builder.buildHash, this, "buildHash"); this.buildType = ApiTypeHelper.requireNonNull(builder.buildType, this, "buildType"); - this.host = ApiTypeHelper.requireNonNull(builder.host, this, "host"); + this.host = builder.host; this.http = builder.http; - this.ip = ApiTypeHelper.requireNonNull(builder.ip, this, "ip"); + this.ip = builder.ip; this.jvm = builder.jvm; this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.network = builder.network; @@ -132,7 +135,7 @@ private NodeInfo(Builder builder) { this.totalIndexingBuffer = builder.totalIndexingBuffer; this.totalIndexingBufferInBytes = builder.totalIndexingBufferInBytes; this.transport = builder.transport; - this.transportAddress = ApiTypeHelper.requireNonNull(builder.transportAddress, this, "transportAddress"); + this.transportAddress = builder.transportAddress; this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); this.modules = ApiTypeHelper.unmodifiable(builder.modules); this.ingest = builder.ingest; @@ -496,11 +499,13 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder * API name: {@code host} */ - public final Builder host(String value) { + public final Builder host(@Nullable String value) { this.host = value; return this; } @@ -618,7 +624,7 @@ public final Builder http(Function * API name: {@code ip} */ - public final Builder ip(String value) { + public final Builder ip(@Nullable String value) { this.ip = value; return this; } @@ -828,7 +834,7 @@ public final Builder transport(Function * API name: {@code transport_address} */ - public final Builder transportAddress(String value) { + public final Builder transportAddress(@Nullable String value) { this.transportAddress = value; return this; } From 09a75d44194e9821890540ef46ae2fa7f5dbc781 Mon Sep 17 00:00:00 2001 From: Dan Cecoi Date: Thu, 8 Aug 2024 11:48:51 +0100 Subject: [PATCH 2/3] Added a CHANGELOG entry, made the getters nullable and removed extra white space Signed-off-by: Dan Cecoi --- CHANGELOG.md | 1 + .../opensearch/client/opensearch/nodes/info/NodeInfo.java | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 402c2bc617..c10e80a4e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ This section is for maintaining a changelog for all breaking changes for the cli ### Fixed - Fixed error when deserializing a normalizer without 'type' ([#1111](https://github.com/opensearch-project/opensearch-java/pull/1111)) - Fixed deserialization of SearchRequest when `_source` is an array ([#1117](https://github.com/opensearch-project/opensearch-java/pull/1117)) +- Removed null constraints on NodeInfo fields that are returned null from Amazon OpenSearch Service ([#1131](https://github.com/opensearch-project/opensearch-java/pull/1131)) ### Security diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfo.java b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfo.java index ea9f2ef1a7..4b97120434 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfo.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfo.java @@ -176,6 +176,7 @@ public final String buildType() { *

* API name: {@code host} */ + @Nullable public final String host() { return this.host; } @@ -193,6 +194,7 @@ public final NodeInfoHttp http() { *

* API name: {@code ip} */ + @Nullable public final String ip() { return this.ip; } @@ -302,6 +304,7 @@ public final NodeInfoTransport transport() { *

* API name: {@code transport_address} */ + @Nullable public final String transportAddress() { return this.transportAddress; } @@ -834,7 +837,7 @@ public final Builder transport(Function * API name: {@code transport_address} */ - public final Builder transportAddress(@Nullable String value) { + public final Builder transportAddress(@Nullable String value) { this.transportAddress = value; return this; } From b97029945c8b80f2b8caaf41db91e69fb9b53fab Mon Sep 17 00:00:00 2001 From: Dan Cecoi Date: Mon, 12 Aug 2024 10:00:12 +0100 Subject: [PATCH 3/3] modified the PR link in the changelog Signed-off-by: Dan Cecoi --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aee2861645..2e65658050 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,7 +42,7 @@ This section is for maintaining a changelog for all breaking changes for the cli ### Removed ### Fixed -- Fixed handling of NodeInfo fields that are not returned by Amazon OpenSearch Service ([#1131](https://github.com/opensearch-project/opensearch-java/pull/1131)) +- Fixed handling of NodeInfo fields that are not returned by Amazon OpenSearch Service ([#1132](https://github.com/opensearch-project/opensearch-java/pull/1132)) ### Security