rhtyd commented on a change in pull request #4565:
URL: https://github.com/apache/cloudstack/pull/4565#discussion_r551183874



##########
File path: 
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
##########
@@ -84,7 +84,11 @@ public boolean parseDomainXML(String domXML) {
                     String authUserName = getAttrValue("auth", "username", 
disk);
                     String poolUuid = getAttrValue("secret", "uuid", disk);
                     String host = getAttrValue("host", "name", disk);
-                    int port = Integer.parseInt(getAttrValue("host", "port", 
disk));
+                    int port = 0;
+                    String _xmlPort = getAttrValue("host", "port", disk);
+                    if ( ! _xmlPort.isEmpty()) {

Review comment:
       Should we do both null and empty check?

##########
File path: 
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolXMLParser.java
##########
@@ -55,7 +55,11 @@ public LibvirtStoragePoolDef parseStoragePoolXML(String 
poolXML) {
             String format = getAttrValue("format", "type", source);
 
             if (type.equalsIgnoreCase("rbd")) {
-                int port = Integer.parseInt(getAttrValue("host", "port", 
source));
+                int port = 0;
+                String _xmlPort = getAttrValue("host", "port", source);
+                if ( ! _xmlPort.isEmpty()) {

Review comment:
       Should we do both null and empty check?




----------------------------------------------------------------
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]


Reply via email to