[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 <fwang12@ebay.com>
Signed-off-by: fwang12 <fwang12@ebay.com>
This commit is contained in:
fwang12 2023-05-28 12:46:09 +08:00
parent 52d3bf25ed
commit 07e590ad26
2 changed files with 8 additions and 0 deletions

View File

@ -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;
}

View File

@ -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;
}