weizhouapache commented on a change in pull request #5810:
URL: https://github.com/apache/cloudstack/pull/5810#discussion_r779764635
##########
File path: server/src/main/java/com/cloud/network/NetworkServiceImpl.java
##########
@@ -1252,8 +1252,8 @@ public Network createGuestNetwork(CreateNetworkCmd cmd)
throws InsufficientCapac
}
}
- boolean ipv4 = true, ipv6 = false;
- if (startIP != null) {
+ boolean ipv4 = false, ipv6 = false;
+ if (org.apache.commons.lang3.StringUtils.isNoneBlank(gateway,
netmask)) {
Review comment:
> @weizhouapache, recently we adopted `org.apache.commons.lang3.StringUtils`
as the default string lib. A checkstyle validation was added to prohibit
imports of `org.apache.commons.lang.StringUtils` and
`com.google.common.base.Strings`, however it does not cover `import static`.
The files that used `import static` were modified to remove the `import static`
and use the object `StringUtils` from `lang3`, however, this file went
unnoticed.
>
> Could you remove those `import static` (`import static
org.apache.commons.lang.StringUtils.isBlank;` and `import static
org.apache.commons.lang.StringUtils.isNotBlank;`) from the begin of the file,
import the `org.apache.commons.lang3.StringUtils` and use it instead?
>
> I observed that `com.cloud.utils.StringUtils` is already imported and
would conflict with `org.apache.commons.lang3.StringUtils`. However,
`com.cloud.utils.StringUtils` is used only twice and
`org.apache.commons.lang3.StringUtils` will be used several times, therefore,
I'd recommend to import `org.apache.commons.lang3.StringUtils` and to use the
full class name of `com.cloud.utils.StringUtils`.
@GutoVeronezi thanks for your comment. it is good #5386 has been merged into
main branch.
However 4.16 does not have it. com.cloud.utils.StringUtils is still imported.
https://github.com/apache/cloudstack/blob/4.16/server/src/main/java/com/cloud/network/NetworkServiceImpl.java#L175
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]