cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexandrelimassantana <...@git.apache.org>
Subject [GitHub] cloudstack pull request: CLOUDSTACK-9165 unable to use reserved IP...
Date Mon, 25 Jan 2016 04:50:50 GMT
Github user alexandrelimassantana commented on the pull request:

    https://github.com/apache/cloudstack/pull/1246#issuecomment-174398371
  
    Hello, there is also something bugging me with this piece of code which appears on the
changed files:
    
    ```java
    final String gatewayCidr = guestNetwork.getNetworkCidr() == null ? guestNetwork.getCidr()
: guestNetwork.getNetworkCidr();
    ```
    
    First, it is repeated code, which could turn into a function in the superclass, since
VirtualNetworkApplianceManagerImpl and NetworkHelpImpl are implementation classes.
    
    Also, you are calling the function getNetworkCidr twice in the event of it's return value
not being null. It's both confusing and not efficient. You could try writing a separate method
for the purpose of correctly setting this variable, such as:
    
    ```java
    protected String getValidGatewayCidr(){
        String gatewayCidr = guestNetwork.getNetworkCidr();
        return gatewayCidr == null ? guestNetwork.getCidr() : null;
    }
    ```
    
    These changes would make the code more understandable, provided that you could write javadocs
on these pieces of code.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message