GutoVeronezi commented on a change in pull request #4789:
URL: https://github.com/apache/cloudstack/pull/4789#discussion_r591440878
##########
File path: server/src/main/java/com/cloud/api/query/dao/HostJoinDaoImpl.java
##########
@@ -274,12 +269,19 @@ public HostResponse newHostResponse(HostJoinVO host,
EnumSet<HostDetails> detail
@Override
public HostResponse setHostResponse(HostResponse response, HostJoinVO
host) {
String tag = host.getTag();
- if (tag != null) {
- if (response.getHostTags() != null &&
response.getHostTags().length() > 0) {
+ if (StringUtils.isNotEmpty(tag)) {
+ if (StringUtils.isNotEmpty(response.getHostTags())) {
response.setHostTags(response.getHostTags() + "," + tag);
} else {
response.setHostTags(tag);
}
+
+ if (!Boolean.TRUE.equals(response.getHaHost())) {
Review comment:
Suggestion:
Some ways to improve this validation:
- As it does not have an `else` operator, we could just validate with
`!responsegetHaHost()`;
- We could use `commons.lang3.BooleanUtils`,
`BooleanUtils.isFalse(response.getHaHost())`;
- As it is validating if it is `false`, we could use
`Boolean.FALSE.equals(response.getHaHost())`;
- Do we use the third value of a Boolean (`null`) in `haHost`, somewhere?
If not, we could do a validation on `getHaHost()`;
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]