This is an automated email from the ASF dual-hosted git repository.
feiwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new 07e590ad2 [KYUUBI #4893] [MINOR] Prevent null collection for rest dto
07e590ad2 is described below
commit 07e590ad26042b002e89e6b30a86d222436d50de
Author: fwang12 <[email protected]>
AuthorDate: Sun May 28 12:46:09 2023 +0800
[KYUUBI #4893] [MINOR] Prevent null collection for rest dto
### _Why are the changes needed?_
As title.
### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including
negative and positive cases if possible
- [ ] Add screenshots for manual tests if appropriate
- [x] [Run
test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests)
locally before make a pull request
Closes #4893 from turboFei/minor_dto.
Closes #4893
aeb5a25a9 [fwang12] prevent null:
Authored-by: fwang12 <[email protected]>
Signed-off-by: fwang12 <[email protected]>
---
.../main/java/org/apache/kyuubi/client/api/v1/dto/OperationData.java | 4 ++++
.../src/main/java/org/apache/kyuubi/client/api/v1/dto/ServerData.java | 4 ++++
2 files changed, 8 insertions(+)
diff --git
a/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/OperationData.java
b/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/OperationData.java
index 8b1f7656e..70c2dd3f3 100644
---
a/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/OperationData.java
+++
b/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/OperationData.java
@@ -17,6 +17,7 @@
package org.apache.kyuubi.client.api.v1.dto;
+import java.util.Collections;
import java.util.Map;
import java.util.Objects;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
@@ -154,6 +155,9 @@ public class OperationData {
}
public Map<String, String> getMetrics() {
+ if (null == metrics) {
+ return Collections.emptyMap();
+ }
return metrics;
}
diff --git
a/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/ServerData.java
b/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/ServerData.java
index 6fe036162..7b68763d2 100644
---
a/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/ServerData.java
+++
b/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/ServerData.java
@@ -17,6 +17,7 @@
package org.apache.kyuubi.client.api.v1.dto;
+import java.util.Collections;
import java.util.Map;
import java.util.Objects;
@@ -94,6 +95,9 @@ public class ServerData {
}
public Map<String, String> getAttributes() {
+ if (null == attributes) {
+ return Collections.emptyMap();
+ }
return attributes;
}