[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-9106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15043856#comment-15043856
 ] 

ASF GitHub Bot commented on CLOUDSTACK-9106:
--------------------------------------------

Github user wilderrodrigues commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1179#discussion_r46769848
  
    --- Diff: server/src/com/cloud/network/element/VirtualRouterElement.java ---
    @@ -841,24 +857,26 @@ public VirtualRouterProvider addElement(final Long 
nspId, final Type providerTyp
     
         @Override
         public boolean applyPFRules(final Network network, final 
List<PortForwardingRule> rules) throws ResourceUnavailableException {
    +        boolean result = false;
             if (canHandle(network, Service.PortForwarding)) {
                 final List<DomainRouterVO> routers = 
_routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER);
                 if (routers == null || routers.isEmpty()) {
                     s_logger.debug("Virtual router elemnt doesn't need to 
apply firewall rules on the backend; virtual " + "router doesn't exist in the 
network " + network.getId());
    -                return true;
    +                result = true;
    --- End diff --
    
    Yes, it would. But I won't change because I don't agree with the approach 
of returning true/false in several places. 
    
    1. A method that returns something should have only one point where it 
actually returns. So those several returns is a bad practice. A way to make it 
not so bad is to assign the return to a variable, so people looking at the code 
in the future won't miss a hidden "return true" somewhere. I did not change all 
of it because in some places it requires a better refactor.
    2. If a method execution cannot proceed due to some condition, it should 
fail - exception. A return false should be used when one wants to check is 
something is valid/exists or not.


> As a Developer I want the Redundant VPC private gateway feature fixed
> ---------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-9106
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9106
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: Virtual Router
>    Affects Versions: 4.6.0
>            Reporter: Wilder Rodrigues
>            Assignee: Wilder Rodrigues
>             Fix For: 4.7.0
>
>
> Bug in BasicNetworkTopology.applyRules() method.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to