You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/10/18 20:54:32 UTC
[GitHub] [cloudstack] GutoVeronezi edited a comment on pull request #5386: Replace string libraries with org.apache.commons.lang3.StringUtils
GutoVeronezi edited a comment on pull request #5386:
URL: https://github.com/apache/cloudstack/pull/5386#issuecomment-946156616
Hi @RodrigoDLopez, thanks for the review!
This PR intended to standardize the using of `org.apache.commons.lang3.StringUtils` and add some minor improvements, like changing:
```java
if (StringUtils.isEmpty(a) || StringUtils.isEmpty(b)) {
```
to
```java
if (StringUtils.isAnyEmpty(a, b)) {
```
And so on.
These minor improvements were made looking for code reducing and improving readability.
Changing:
```java
StringUtils.defaultIfEmpty(entry.get(VmDetailConstants.IP4_ADDRESS), null);
```
To:
```java
StringUtils.isEmpty(entry.get(VmDetailConstants.IP4_ADDRESS) ? null : entry.get(VmDetailConstants.IP4_ADDRESS;
```
Or:
```java
String var = entry.get(VmDetailConstants.IP4_ADDRESS);
StringUtils.defaultIfEmpty(var, null);
```
To:
```java
String var = entry.get(VmDetailConstants.IP4_ADDRESS);
StringUtils.isEmpty(var) ? null : var;
```
Sounds neither more nor less readable, for me.
Is there any technical reason to change it?
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org