Fix if/else/for/while/do statements that lack braces 08/22508/1
authorRyan Moats <rmoats@us.ibm.com>
Fri, 12 Jun 2015 21:19:51 +0000 (16:19 -0500)
committerRyan Moats <rmoats@us.ibm.com>
Fri, 12 Jun 2015 21:41:20 +0000 (16:41 -0500)
Change-Id: Iaeaa652a2c06115e05c6e8db0ba4638af275f856
Signed-off-by: Ryan Moats <rmoats@us.ibm.com>
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronLoadBalancerPool.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronFloatingIPsNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronLoadBalancerPoolMembersNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronMeteringLabelRulesNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronMeteringLabelsNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronRoutersNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronSecurityGroupsNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVPNIKEPoliciesNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVPNIPSECPoliciesNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVPNIPSECSiteConnectionsNorthbound.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVPNServicesNorthbound.java

index 137ce204369657810571221116256c170cfc8112..88ec9803fc2bc4c7c97bb01527099758246a320a 100644 (file)
@@ -162,8 +162,9 @@ public class NeutronLoadBalancerPool implements Serializable {
          * Update the pool_id of the member to that this.loadBalancerPoolID
          */
         if (loadBalancerPoolMembers != null) {
-            for (NeutronLoadBalancerPoolMember member: loadBalancerPoolMembers)
+            for (NeutronLoadBalancerPoolMember member: loadBalancerPoolMembers) {
                 member.setPoolID(loadBalancerPoolID);
+            }
             return loadBalancerPoolMembers;
         }
         return loadBalancerPoolMembers;
@@ -201,10 +202,10 @@ public class NeutronLoadBalancerPool implements Serializable {
             if(s.equals("protocol")) {
                 ans.setLoadBalancerPoolProtocol(this.getLoadBalancerPoolProtocol());
             }
-            if(s.equals("lb_algorithm")) {
+            if (s.equals("lb_algorithm")) {
                 ans.setLoadBalancerPoolLbAlgorithm(this.getLoadBalancerPoolLbAlgorithm());
             }
-            if(s.equals("healthmonitor_id")) {
+            if (s.equals("healthmonitor_id")) {
                 ans.setNeutronLoadBalancerPoolHealthMonitorID(this.getNeutronLoadBalancerPoolHealthMonitorID());
             }
             if (s.equals("admin_state_up")) {
index c02205e06a0119133c1b5b06037498c6da123de7..63e62fc2f07e374079b6498e26d62279789e3ab2 100644 (file)
@@ -110,10 +110,11 @@ public class NeutronFloatingIPsNorthbound {
                     (queryStatus == null || queryStatus.equals(oSS.getStatus())) &&
                     (queryRouterID == null || queryRouterID.equals(oSS.getRouterUUID())) &&
                     (queryTenantID == null || queryTenantID.equals(oSS.getTenantUUID()))) {
-                if (fields.size() > 0)
+                if (fields.size() > 0) {
                     ans.add(extractFields(oSS,fields));
-                else
+                } else {
                     ans.add(oSS);
+                }
             }
         }
         //TODO: apply pagination to results
@@ -142,8 +143,9 @@ public class NeutronFloatingIPsNorthbound {
             throw new ServiceUnavailableException("Floating IP CRUD Interface "
                     + RestMessages.SERVICEUNAVAILABLE.toString());
         }
-        if (!floatingIPInterface.floatingIPExists(floatingipUUID))
+        if (!floatingIPInterface.floatingIPExists(floatingipUUID)) {
             throw new ResourceNotFoundException("Floating IP UUID doesn't exist.");
+        }
         if (fields.size() > 0) {
             NeutronFloatingIP ans = floatingIPInterface.getFloatingIP(floatingipUUID);
             return Response.status(200).entity(
@@ -191,60 +193,74 @@ public class NeutronFloatingIPsNorthbound {
         if (input.isSingleton()) {
             NeutronFloatingIP singleton = input.getSingleton();
             // check existence of id in cache and return badrequest if exists
-            if (floatingIPInterface.floatingIPExists(singleton.getID()))
+            if (floatingIPInterface.floatingIPExists(singleton.getID())) {
                 throw new BadRequestException("Floating IP UUID already exists.");
+            }
             // check if the external network is specified, exists, and is an external network
             String externalNetworkUUID = singleton.getFloatingNetworkUUID();
-            if (externalNetworkUUID == null)
+            if (externalNetworkUUID == null) {
                 throw new BadRequestException("external network UUID doesn't exist.");
-            if (!networkInterface.networkExists(externalNetworkUUID))
+            }
+            if (!networkInterface.networkExists(externalNetworkUUID)) {
                 throw new BadRequestException("external network UUID doesn't exist.");
+            }
             NeutronNetwork externNetwork = networkInterface.getNetwork(externalNetworkUUID);
-            if (!externNetwork.isRouterExternal())
+            if (!externNetwork.isRouterExternal()) {
                 throw new BadRequestException("external network isn't marked router:external");
+            }
             // if floating IP is specified, make sure it can come from the network
             String floatingIP = singleton.getFloatingIPAddress();
             if (floatingIP != null) {
-                if (externNetwork.getSubnets().size() != 1)
+                if (externNetwork.getSubnets().size() != 1) {
                     throw new BadRequestException("external network doesn't have a subnet");
+                }
                 NeutronSubnet externSubnet = subnetInterface.getSubnet(externNetwork.getSubnets().get(0));
-                if (!externSubnet.isValidIP(floatingIP))
+                if (!externSubnet.isValidIP(floatingIP)) {
                     throw new BadRequestException("external IP isn't valid for the specified subnet.");
-                if (externSubnet.getFloatingIpPortsInSubnet(floatingIP).isEmpty() && externSubnet.isIPInUse(floatingIP))
+                }
+                if (externSubnet.getFloatingIpPortsInSubnet(floatingIP).isEmpty() && externSubnet.isIPInUse(floatingIP)) {
                     throw new ResourceConflictException("floating IP is in use.");
+                }
             }
             // if port_id is specified, then check that the port exists and has at least one IP
             String port_id = singleton.getPortUUID();
             if (port_id != null) {
                 String fixedIP = null;        // used for the fixedIP calculation
-                if (!portInterface.portExists(port_id))
+                if (!portInterface.portExists(port_id)) {
                     throw new ResourceNotFoundException("Port UUID doesn't exist.");
+                }
                 NeutronPort port = portInterface.getPort(port_id);
-                if (port.getFixedIPs().size() < 1)
+                if (port.getFixedIPs().size() < 1) {
                     throw new BadRequestException("port UUID doesn't have an IP address.");
+                }
                 // if there is more than one fixed IP then check for fixed_ip_address
                 // and that it is in the list of port addresses
                 if (port.getFixedIPs().size() > 1) {
                     fixedIP = singleton.getFixedIPAddress();
-                    if (fixedIP == null)
+                    if (fixedIP == null) {
                         throw new BadRequestException("fixed IP address doesn't exist.");
+                    }
                     Iterator<Neutron_IPs> i = port.getFixedIPs().iterator();
                     boolean validFixedIP = false;
                     while (i.hasNext() && !validFixedIP) {
                         Neutron_IPs ip = i.next();
-                        if (ip.getIpAddress().equals(fixedIP))
+                        if (ip.getIpAddress().equals(fixedIP)) {
                             validFixedIP = true;
+                        }
                     }
-                    if (!validFixedIP)
+                    if (!validFixedIP) {
                         throw new BadRequestException("can't find a valid fixed IP address");
+                    }
                 } else {
                     fixedIP = port.getFixedIPs().get(0).getIpAddress();
-                    if (singleton.getFixedIPAddress() != null && !fixedIP.equalsIgnoreCase(singleton.getFixedIPAddress()))
+                    if (singleton.getFixedIPAddress() != null && !fixedIP.equalsIgnoreCase(singleton.getFixedIPAddress())) {
                         throw new BadRequestException("mismatched fixed IP address in request");
+                    }
                 }
                 //lastly check that this fixed IP address isn't already used
-                if (port.isBoundToFloatingIP(fixedIP))
+                if (port.isBoundToFloatingIP(fixedIP)) {
                     throw new ResourceConflictException("fixed IP is in use.");
+                }
                 singleton.setFixedIPAddress(fixedIP);
             }
             Object[] instances = NeutronUtil.getInstances(INeutronFloatingIPAware.class, this);
@@ -253,8 +269,9 @@ public class NeutronFloatingIPsNorthbound {
                     for (Object instance : instances) {
                         INeutronFloatingIPAware service = (INeutronFloatingIPAware) instance;
                         int status = service.canCreateFloatingIP(singleton);
-                        if (status < 200 || status > 299)
+                        if (status < 200 || status > 299) {
                             return Response.status(status).build();
+                        }
                     }
                 } else {
                     throw new ServiceUnavailableException("No providers registered.  Please try again later");
@@ -314,15 +331,18 @@ public class NeutronFloatingIPsNorthbound {
             throw new ServiceUnavailableException("Port CRUD Interface "
                     + RestMessages.SERVICEUNAVAILABLE.toString());
         }
-        if (!floatingIPInterface.floatingIPExists(floatingipUUID))
+        if (!floatingIPInterface.floatingIPExists(floatingipUUID)) {
             throw new ResourceNotFoundException("Floating IP UUID doesn't exist.");
+        }
 
         NeutronFloatingIP sourceFloatingIP = floatingIPInterface.getFloatingIP(floatingipUUID);
-        if (!input.isSingleton())
+        if (!input.isSingleton()) {
             throw new BadRequestException("only singleton requests allowed.");
+        }
         NeutronFloatingIP singleton = input.getSingleton();
-        if (singleton.getID() == null)
+        if (singleton.getID() == null) {
             throw new BadRequestException("singleton UUID doesn't exist.");
+        }
 
         NeutronNetwork externNetwork = networkInterface.getNetwork(
                 sourceFloatingIP.getFloatingNetworkUUID());
@@ -330,48 +350,58 @@ public class NeutronFloatingIPsNorthbound {
         // if floating IP is specified, make sure it can come from the network
         String floatingIP = singleton.getFloatingIPAddress();
         if (floatingIP != null) {
-            if (externNetwork.getSubnets().size() != 1)
+            if (externNetwork.getSubnets().size() != 1) {
                 throw new BadRequestException("external network doesn't have a subnet.");
+            }
             NeutronSubnet externSubnet = subnetInterface.getSubnet(externNetwork.getSubnets().get(0));
-            if (!externSubnet.isValidIP(floatingIP))
+            if (!externSubnet.isValidIP(floatingIP)) {
                 throw new BadRequestException("floating IP not valid for external subnet");
-            if (externSubnet.isIPInUse(floatingIP))
+            }
+            if (externSubnet.isIPInUse(floatingIP)) {
                 throw new ResourceConflictException("floating IP is in use.");
+            }
         }
 
         // if port_id is specified, then check that the port exists and has at least one IP
         String port_id = singleton.getPortUUID();
         if (port_id != null) {
             String fixedIP = null;        // used for the fixedIP calculation
-            if (!portInterface.portExists(port_id))
+            if (!portInterface.portExists(port_id)) {
                 throw new ResourceNotFoundException("Port UUID doesn't exist.");
+            }
             NeutronPort port = portInterface.getPort(port_id);
-            if (port.getFixedIPs().size() < 1)
+            if (port.getFixedIPs().size() < 1) {
                 throw new BadRequestException("port ID doesn't have a fixed IP address.");
+            }
             // if there is more than one fixed IP then check for fixed_ip_address
             // and that it is in the list of port addresses
             if (port.getFixedIPs().size() > 1) {
                 fixedIP = singleton.getFixedIPAddress();
-                if (fixedIP == null)
+                if (fixedIP == null) {
                     throw new BadRequestException("request doesn't have a fixed IP address");
+                }
                 Iterator<Neutron_IPs> i = port.getFixedIPs().iterator();
                 boolean validFixedIP = false;
                 while (i.hasNext() && !validFixedIP) {
                     Neutron_IPs ip = i.next();
-                    if (ip.getIpAddress().equals(fixedIP))
+                    if (ip.getIpAddress().equals(fixedIP)) {
                         validFixedIP = true;
+                    }
                 }
-                if (!validFixedIP)
+                if (!validFixedIP) {
                     throw new BadRequestException("couldn't find a valid fixed IP address");
+                }
             } else {
                 fixedIP = port.getFixedIPs().get(0).getIpAddress();
                 if (singleton.getFixedIPAddress() != null &&
-                        !fixedIP.equalsIgnoreCase(singleton.getFixedIPAddress()))
+                        !fixedIP.equalsIgnoreCase(singleton.getFixedIPAddress())) {
                     throw new BadRequestException("mismatch in fixed IP addresses");
+                }
             }
             //lastly check that this fixed IP address isn't already used
-            if (port.isBoundToFloatingIP(fixedIP))
+            if (port.isBoundToFloatingIP(fixedIP)) {
                 throw new ResourceConflictException("fixed IP is in use.");
+            }
             singleton.setFixedIPAddress(fixedIP);
         }
         NeutronFloatingIP target = floatingIPInterface.getFloatingIP(floatingipUUID);
@@ -381,8 +411,9 @@ public class NeutronFloatingIPsNorthbound {
                 for (Object instance : instances) {
                     INeutronFloatingIPAware service = (INeutronFloatingIPAware) instance;
                     int status = service.canUpdateFloatingIP(singleton, target);
-                    if (status < 200 || status > 299)
+                    if (status < 200 || status > 299) {
                         return Response.status(status).build();
+                    }
                 }
             } else {
                 throw new ServiceUnavailableException("No providers registered.  Please try again later");
@@ -421,8 +452,9 @@ public class NeutronFloatingIPsNorthbound {
             throw new ServiceUnavailableException("Floating IP CRUD Interface "
                     + RestMessages.SERVICEUNAVAILABLE.toString());
         }
-        if (!floatingIPInterface.floatingIPExists(floatingipUUID))
+        if (!floatingIPInterface.floatingIPExists(floatingipUUID)) {
             throw new ResourceNotFoundException("Floating IP UUID doesn't exist.");
+        }
         // TODO: need to undo port association if it exists
         NeutronFloatingIP singleton = floatingIPInterface.getFloatingIP(floatingipUUID);
         Object[] instances = NeutronUtil.getInstances(INeutronFloatingIPAware.class, this);
@@ -431,8 +463,9 @@ public class NeutronFloatingIPsNorthbound {
                 for (Object instance : instances) {
                     INeutronFloatingIPAware service = (INeutronFloatingIPAware) instance;
                     int status = service.canDeleteFloatingIP(singleton);
-                    if (status < 200 || status > 299)
+                    if (status < 200 || status > 299) {
                         return Response.status(status).build();
+                    }
                 }
             } else {
                 throw new ServiceUnavailableException("No providers registered.  Please try again later");
index 8c1632e29731d2fe4c7063c9b823c5d958066a4f..67152789740f4ddf2c9bfb2535c68f771033b723 100644 (file)
@@ -143,8 +143,9 @@ public Response showLoadBalancerPoolMember(
     List<NeutronLoadBalancerPoolMember> members =
                 loadBalancerPoolInterface.getNeutronLoadBalancerPool(loadBalancerPoolUUID).getLoadBalancerPoolMembers();
     for (NeutronLoadBalancerPoolMember ans: members) {
-        if (!ans.getPoolMemberID().equals(loadBalancerPoolMemberUUID))
+        if (!ans.getPoolMemberID().equals(loadBalancerPoolMemberUUID)) {
             continue;
+        }
 
         if (fields.size() > 0) {
             return Response.status(200).entity(
@@ -195,8 +196,9 @@ public Response createLoadBalancerPoolMember(
         if (singletonPool.getLoadBalancerPoolMembers() != null) {
             List<NeutronLoadBalancerPoolMember> members = singletonPool.getLoadBalancerPoolMembers();
             for (NeutronLoadBalancerPoolMember member: members) {
-                if (member.getPoolMemberID().equals(loadBalancerPoolMemberUUID))
+                if (member.getPoolMemberID().equals(loadBalancerPoolMemberUUID)) {
                     throw new BadRequestException("LoadBalancerPoolMember UUID already exists");
+                }
             }
         }
 
@@ -243,8 +245,9 @@ public Response createLoadBalancerPoolMember(
              */
             List<NeutronLoadBalancerPoolMember> members = singletonPool.getLoadBalancerPoolMembers();
             for (NeutronLoadBalancerPoolMember member: members) {
-                if (member.getPoolMemberID().equals(loadBalancerPoolMemberUUID))
+                if (member.getPoolMemberID().equals(loadBalancerPoolMemberUUID)) {
                     throw new BadRequestException("LoadBalancerPoolMember UUID already exists");
+                }
             }
 
             if (testMap.containsKey(test.getPoolMemberID())) {
@@ -345,8 +348,9 @@ public Response deleteLoadBalancerPoolMember(
             break;
         }
     }
-    if (singleton == null)
+    if (singleton == null) {
         throw new BadRequestException("LoadBalancerPoolMember UUID does not exist.");
+    }
 
     Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolMemberAware.class, this);
     if (instances != null) {
index 2ed61b6e76bb0258d44f80e22b5fcbfdff896903..dd7bd8e9166629757710a1dfc3e49e5a68e01efe 100644 (file)
@@ -99,10 +99,11 @@ public class NeutronMeteringLabelRulesNorthbound {
                     (queryDirection == null || queryDirection.equals(oSS.getMeteringLabelRuleDirection())) &&
                     (queryRemoteIPPrefix == null || queryRemoteIPPrefix.equals(oSS.getMeteringLabelRuleRemoteIPPrefix())) &&
                     (queryLabelID == null || queryLabelID.equals(oSS.getMeteringLabelRuleLabelID()))) {
-                if (fields.size() > 0)
+                if (fields.size() > 0) {
                     ans.add(extractFields(oSS,fields));
-                else
+                } else {
                     ans.add(oSS);
+                }
             }
         }
         //TODO: apply pagination to results
@@ -169,16 +170,18 @@ public class NeutronMeteringLabelRulesNorthbound {
             /*
              * verify that the meteringLabelRule doesn't already exist (issue: is deeper inspection necessary?)
              */
-            if (meteringLabelRuleInterface.neutronMeteringLabelRuleExists(singleton.getMeteringLabelRuleUUID()))
+            if (meteringLabelRuleInterface.neutronMeteringLabelRuleExists(singleton.getMeteringLabelRuleUUID())) {
                 throw new BadRequestException("meteringLabelRule UUID already exists");
+            }
             Object[] instances = NeutronUtil.getInstances(INeutronMeteringLabelRuleAware.class, this);
             if (instances != null) {
                 if (instances.length > 0) {
                     for (Object instance : instances) {
                         INeutronMeteringLabelRuleAware service = (INeutronMeteringLabelRuleAware) instance;
                         int status = service.canCreateMeteringLabelRule(singleton);
-                        if (status < 200 || status > 299)
+                        if (status < 200 || status > 299) {
                             return Response.status(status).build();
+                        }
                     }
                 } else {
                     throw new ServiceUnavailableException("No providers registered.  Please try again later");
@@ -230,8 +233,9 @@ public class NeutronMeteringLabelRulesNorthbound {
         /*
          * verify that the meteringLabelRule exists and is not in use before removing it
          */
-        if (!meteringLabelRuleInterface.neutronMeteringLabelRuleExists(ruleUUID))
+        if (!meteringLabelRuleInterface.neutronMeteringLabelRuleExists(ruleUUID)) {
             throw new ResourceNotFoundException("MeteringLabelRule UUID not found");
+        }
         NeutronMeteringLabelRule singleton = meteringLabelRuleInterface.getNeutronMeteringLabelRule(ruleUUID);
         Object[] instances = NeutronUtil.getInstances(INeutronMeteringLabelRuleAware.class, this);
         if (instances != null) {
@@ -239,8 +243,9 @@ public class NeutronMeteringLabelRulesNorthbound {
                 for (Object instance : instances) {
                     INeutronMeteringLabelRuleAware service = (INeutronMeteringLabelRuleAware) instance;
                     int status = service.canDeleteMeteringLabelRule(singleton);
-                    if (status < 200 || status > 299)
+                    if (status < 200 || status > 299) {
                         return Response.status(status).build();
+                    }
                 }
             } else {
                 throw new ServiceUnavailableException("No providers registered.  Please try again later");
index 938703bd5aaf99bb5c53dc5889f3ca93a667f85b..31a83c14065cbed02fed265fd3ffd291ba2fcedb 100644 (file)
@@ -99,10 +99,11 @@ public class NeutronMeteringLabelsNorthbound {
                     (queryName == null || queryName.equals(oSS.getMeteringLabelName())) &&
                     (queryDescription == null || queryDescription.equals(oSS.getMeteringLabelDescription())) &&
                     (queryTenantID == null || queryTenantID.equals(oSS.getMeteringLabelTenantID()))) {
-                if (fields.size() > 0)
+                if (fields.size() > 0) {
                     ans.add(extractFields(oSS,fields));
-                else
+                } else {
                     ans.add(oSS);
+                }
             }
         }
         //TODO: apply pagination to results
@@ -169,16 +170,18 @@ public class NeutronMeteringLabelsNorthbound {
             /*
              * verify that the meteringLabel doesn't already exist (issue: is deeper inspection necessary?)
              */
-            if (meteringLabelInterface.neutronMeteringLabelExists(singleton.getMeteringLabelUUID()))
+            if (meteringLabelInterface.neutronMeteringLabelExists(singleton.getMeteringLabelUUID())) {
                 throw new BadRequestException("meteringLabel UUID already exists");
+            }
             Object[] instances = NeutronUtil.getInstances(INeutronMeteringLabelAware.class, this);
             if (instances != null) {
                 if (instances.length > 0) {
                     for (Object instance : instances) {
                         INeutronMeteringLabelAware service = (INeutronMeteringLabelAware) instance;
                         int status = service.canCreateMeteringLabel(singleton);
-                        if (status < 200 || status > 299)
+                        if (status < 200 || status > 299) {
                             return Response.status(status).build();
+                        }
                     }
                 } else {
                     throw new ServiceUnavailableException("No providers registered.  Please try again later");
@@ -230,8 +233,9 @@ public class NeutronMeteringLabelsNorthbound {
         /*
          * verify that the meteringLabel exists and is not in use before removing it
          */
-        if (!meteringLabelInterface.neutronMeteringLabelExists(labelUUID))
+        if (!meteringLabelInterface.neutronMeteringLabelExists(labelUUID)) {
             throw new ResourceNotFoundException("MeteringLabel UUID not found");
+        }
         NeutronMeteringLabel singleton = meteringLabelInterface.getNeutronMeteringLabel(labelUUID);
         Object[] instances = NeutronUtil.getInstances(INeutronMeteringLabelAware.class, this);
         if (instances != null) {
@@ -239,8 +243,9 @@ public class NeutronMeteringLabelsNorthbound {
                 for (Object instance : instances) {
                     INeutronMeteringLabelAware service = (INeutronMeteringLabelAware) instance;
                     int status = service.canDeleteMeteringLabel(singleton);
-                    if (status < 200 || status > 299)
+                    if (status < 200 || status > 299) {
                         return Response.status(status).build();
+                    }
                 }
             } else {
                 throw new ServiceUnavailableException("No providers registered.  Please try again later");
index 6e1de5d45e769faebb2f0b6829c429ddb1a8ac85..40e36d44c3ae1b2b644da1a87e90bd303fd122e6 100644 (file)
@@ -109,10 +109,11 @@ public class NeutronRoutersNorthbound {
                     (queryStatus == null || queryStatus.equals(oSS.getStatus())) &&
                     (queryExternalGatewayInfo == null || queryExternalGatewayInfo.equals(oSS.getExternalGatewayInfo())) &&
                     (queryTenantID == null || queryTenantID.equals(oSS.getTenantID()))) {
-                if (fields.size() > 0)
+                if (fields.size() > 0) {
                     ans.add(extractFields(oSS,fields));
-                else
+                } else {
                     ans.add(oSS);
+                }
             }
         }
         //TODO: apply pagination to results
@@ -187,15 +188,18 @@ public class NeutronRoutersNorthbound {
              * if there is external gateway information provided, verify that the specified network
              * exists and has been designated as "router:external"
              */
-            if (routerInterface.routerExists(singleton.getID()))
+            if (routerInterface.routerExists(singleton.getID())) {
                 throw new BadRequestException("router UUID already exists");
+            }
             if (singleton.getExternalGatewayInfo() != null) {
                 String externNetworkPtr = singleton.getExternalGatewayInfo().getNetworkID();
-                if (!networkInterface.networkExists(externNetworkPtr))
+                if (!networkInterface.networkExists(externNetworkPtr)) {
                     throw new BadRequestException("External Network Pointer doesn't exist");
+                }
                 NeutronNetwork externNetwork = networkInterface.getNetwork(externNetworkPtr);
-                if (!externNetwork.isRouterExternal())
+                if (!externNetwork.isRouterExternal()) {
                     throw new BadRequestException("External Network Pointer isn't marked as router:external");
+                }
             }
             Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this);
             if (instances != null) {
@@ -203,8 +207,9 @@ public class NeutronRoutersNorthbound {
                     for (Object instance : instances) {
                         INeutronRouterAware service = (INeutronRouterAware) instance;
                         int status = service.canCreateRouter(singleton);
-                        if (status < 200 || status > 299)
+                        if (status < 200 || status > 299) {
                             return Response.status(status).build();
+                        }
                     }
                 } else {
                     throw new ServiceUnavailableException("No providers registered.  Please try again later");
@@ -266,10 +271,12 @@ public class NeutronRoutersNorthbound {
         /*
          * router has to exist and only a single delta can be supplied
          */
-        if (!routerInterface.routerExists(routerUUID))
+        if (!routerInterface.routerExists(routerUUID)) {
             throw new ResourceNotFoundException("Router UUID not found");
-        if (!input.isSingleton())
+        }
+        if (!input.isSingleton()) {
             throw new BadRequestException("Only single router deltas supported");
+        }
         NeutronRouter singleton = input.getSingleton();
         NeutronRouter original = routerInterface.getRouter(routerUUID);
 
@@ -277,8 +284,9 @@ public class NeutronRoutersNorthbound {
          * attribute changes blocked by Neutron
          */
         if (singleton.getID() != null || singleton.getTenantID() != null ||
-                singleton.getStatus() != null)
+                singleton.getStatus() != null) {
             throw new BadRequestException("Request attribute change not allowed");
+        }
 
         Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this);
         if (instances != null) {
@@ -286,8 +294,9 @@ public class NeutronRoutersNorthbound {
                 for (Object instance : instances) {
                     INeutronRouterAware service = (INeutronRouterAware) instance;
                     int status = service.canUpdateRouter(singleton, original);
-                    if (status < 200 || status > 299)
+                    if (status < 200 || status > 299) {
                         return Response.status(status).build();
+                    }
                 }
             } else {
                 throw new ServiceUnavailableException("No providers registered.  Please try again later");
@@ -301,11 +310,13 @@ public class NeutronRoutersNorthbound {
          */
         if (singleton.getExternalGatewayInfo() != null) {
             String externNetworkPtr = singleton.getExternalGatewayInfo().getNetworkID();
-            if (!networkInterface.networkExists(externNetworkPtr))
+            if (!networkInterface.networkExists(externNetworkPtr)) {
                 throw new BadRequestException("External Network Pointer does not exist");
+            }
             NeutronNetwork externNetwork = networkInterface.getNetwork(externNetworkPtr);
-            if (!externNetwork.isRouterExternal())
+            if (!externNetwork.isRouterExternal()) {
                 throw new BadRequestException("External Network Pointer isn't marked as router:external");
+            }
         }
 
         /*
@@ -347,10 +358,12 @@ public class NeutronRoutersNorthbound {
         /*
          * verify that the router exists and is not in use before removing it
          */
-        if (!routerInterface.routerExists(routerUUID))
+        if (!routerInterface.routerExists(routerUUID)) {
             throw new ResourceNotFoundException("Router UUID not found");
-        if (routerInterface.routerInUse(routerUUID))
+        }
+        if (routerInterface.routerInUse(routerUUID)) {
             throw new ResourceConflictException("Router UUID in Use");
+        }
         NeutronRouter singleton = routerInterface.getRouter(routerUUID);
         Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this);
         if (instances != null) {
@@ -358,8 +371,9 @@ public class NeutronRoutersNorthbound {
                 for (Object instance : instances) {
                     INeutronRouterAware service = (INeutronRouterAware) instance;
                     int status = service.canDeleteRouter(singleton);
-                    if (status < 200 || status > 299)
+                    if (status < 200 || status > 299) {
                         return Response.status(status).build();
+                    }
                 }
             } else {
                 throw new ServiceUnavailableException("No providers registered.  Please try again later");
@@ -417,39 +431,48 @@ public class NeutronRoutersNorthbound {
          *  While the Neutron specification says that the router has to exist and the input can only specify either a subnet id
          *  or a port id, but not both, this code assumes that the plugin has filled everything in for us and so both must be present
          */
-        if (!routerInterface.routerExists(routerUUID))
+        if (!routerInterface.routerExists(routerUUID)) {
             throw new BadRequestException("Router UUID doesn't exist");
+        }
         NeutronRouter target = routerInterface.getRouter(routerUUID);
         if (input.getSubnetUUID() == null ||
-                    input.getPortUUID() == null)
+                    input.getPortUUID() == null) {
             throw new BadRequestException("Must specify at subnet id, port id or both");
+        }
 
         // check that the port is part of the subnet
         NeutronSubnet targetSubnet = subnetInterface.getSubnet(input.getSubnetUUID());
-        if (targetSubnet == null)
+        if (targetSubnet == null) {
             throw new BadRequestException("Subnet id doesn't exist");
+        }
         NeutronPort targetPort = portInterface.getPort(input.getPortUUID());
-        if (targetPort == null)
+        if (targetPort == null) {
             throw new BadRequestException("Port id doesn't exist");
-        if (!targetSubnet.getPortsInSubnet().contains(targetPort))
+        }
+        if (!targetSubnet.getPortsInSubnet().contains(targetPort)) {
             throw new BadRequestException("Port id not part of subnet id");
+        }
 
-        if (targetPort.getFixedIPs().size() != 1)
+        if (targetPort.getFixedIPs().size() != 1) {
             throw new BadRequestException("Port id must have a single fixedIP address");
-        if (targetPort.getDeviceID() != null && !targetPort.getDeviceID().equals(routerUUID))
+        }
+        if (targetPort.getDeviceID() != null && !targetPort.getDeviceID().equals(routerUUID)) {
             throw new ResourceConflictException("Target Port already allocated to a different device id");
+        }
         if (targetPort.getDeviceOwner() != null &&
             !targetPort.getDeviceOwner().equalsIgnoreCase(ROUTER_INTERFACE_STR) &&
-            !targetPort.getDeviceOwner().equalsIgnoreCase(ROUTER_GATEWAY_STR))
+            !targetPort.getDeviceOwner().equalsIgnoreCase(ROUTER_GATEWAY_STR)) {
             throw new ResourceConflictException("Target Port already allocated to non-router interface");
+        }
         Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this);
         if (instances != null) {
             if (instances.length > 0) {
                 for (Object instance : instances) {
                     INeutronRouterAware service = (INeutronRouterAware) instance;
                     int status = service.canAttachInterface(target, input);
-                    if (status < 200 || status > 299)
+                    if (status < 200 || status > 299) {
                         return Response.status(status).build();
+                    }
                 }
             } else {
                 throw new ServiceUnavailableException("No providers registered.  Please try again later");
@@ -459,8 +482,9 @@ public class NeutronRoutersNorthbound {
         }
 
         //mark the port device id and device owner fields
-        if (targetPort.getDeviceOwner() == null || targetPort.getDeviceOwner().isEmpty())
+        if (targetPort.getDeviceOwner() == null || targetPort.getDeviceOwner().isEmpty()) {
             targetPort.setDeviceOwner(ROUTER_INTERFACE_STR);
+        }
         targetPort.setDeviceID(routerUUID);
 
         target.addInterface(input.getPortUUID(), input);
@@ -511,8 +535,9 @@ public class NeutronRoutersNorthbound {
         }
 
         // verify the router exists
-        if (!routerInterface.routerExists(routerUUID))
+        if (!routerInterface.routerExists(routerUUID)) {
             throw new BadRequestException("Router does not exist");
+        }
         NeutronRouter target = routerInterface.getRouter(routerUUID);
 
         /*
@@ -522,8 +547,9 @@ public class NeutronRoutersNorthbound {
         if (input.getPortUUID() == null &&
                 input.getSubnetUUID() != null) {
             NeutronPort port = portInterface.getGatewayPort(input.getSubnetUUID());
-            if (port == null)
+            if (port == null) {
                 throw new ResourceNotFoundException("Port UUID not found");
+            }
             input.setPortUUID(port.getID());
             input.setID(target.getID());
             input.setTenantID(target.getTenantID());
@@ -534,8 +560,9 @@ public class NeutronRoutersNorthbound {
                     for (Object instance : instances) {
                         INeutronRouterAware service = (INeutronRouterAware) instance;
                         int status = service.canDetachInterface(target, input);
-                        if (status < 200 || status > 299)
+                        if (status < 200 || status > 299) {
                             return Response.status(status).build();
+                        }
                     }
                 } else {
                     throw new ServiceUnavailableException("No providers registered.  Please try again later");
@@ -577,8 +604,9 @@ public class NeutronRoutersNorthbound {
                     for (Object instance : instances) {
                         INeutronRouterAware service = (INeutronRouterAware) instance;
                         int status = service.canDetachInterface(target, input);
-                        if (status < 200 || status > 299)
+                        if (status < 200 || status > 299) {
                             return Response.status(status).build();
+                        }
                     }
                 } else {
                     throw new ServiceUnavailableException("No providers registered.  Please try again later");
@@ -615,16 +643,18 @@ public class NeutronRoutersNorthbound {
             if (subnet == null) {
                 throw new ResourceNotFoundException("Subnet UUID not found");
             }
-            if (!subnet.isValidIP(port.getFixedIPs().get(0).getIpAddress()))
+            if (!subnet.isValidIP(port.getFixedIPs().get(0).getIpAddress())) {
                 throw new ResourceConflictException("Target Port IP not in Target Subnet");
+            }
             Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this);
             if (instances != null) {
                 if (instances.length > 0) {
                     for (Object instance : instances) {
                         INeutronRouterAware service = (INeutronRouterAware) instance;
                         int status = service.canDetachInterface(target, input);
-                        if (status < 200 || status > 299)
+                        if (status < 200 || status > 299) {
                             return Response.status(status).build();
+                        }
                     }
                 } else {
                     throw new ServiceUnavailableException("No providers registered.  Please try again later");
index 86fc6e337fd755beedf9ba30c94c98177bbf0ec1..4e5b3a3628b6398d932d591cbfc1f5b39b6d1405 100644 (file)
@@ -223,7 +223,9 @@ public class NeutronSecurityGroupsNorthbound {
                         for (Object instance : instances) {
                             INeutronSecurityGroupAware service = (INeutronSecurityGroupAware) instance;
                             int status = service.canCreateNeutronSecurityGroup(test);
-                            if ((status < 200) || (status > 299)) return Response.status(status).build();
+                            if ((status < 200) || (status > 299)) {
+                                return Response.status(status).build();
+                            }
                         }
                     } else {
                         throw new BadRequestException("No providers registered.  Please try again later");
index 727dd768203b5782896542bf6ddf2b158faedcfd..390d058115a5fb79f6b06c1494f2c354b04a7c03 100644 (file)
@@ -108,10 +108,11 @@ public class NeutronVPNIKEPoliciesNorthbound {
                     (queryPFS == null || queryPFS.equals(oSS.getPerfectForwardSecrecy())) &&
                     (queryIKEVersion == null || queryIKEVersion.equals(oSS.getIkeVersion())) &&
                     (queryTenantID == null || queryTenantID.equals(oSS.getTenantID()))) {
-                if (fields.size() > 0)
+                if (fields.size() > 0) {
                     ans.add(extractFields(oSS,fields));
-                else
+                } else {
                     ans.add(oSS);
+                }
             }
         }
         //TODO: apply pagination to results
@@ -179,16 +180,18 @@ public class NeutronVPNIKEPoliciesNorthbound {
             /*
              * verify that the ikePolicy doesn't already exist (issue: is deeper inspection necessary?)
              */
-            if (ikePolicyInterface.neutronVPNIKEPolicyExists(singleton.getID()))
+            if (ikePolicyInterface.neutronVPNIKEPolicyExists(singleton.getID())) {
                 throw new BadRequestException("ikePolicy UUID already exists");
+            }
             Object[] instances = NeutronUtil.getInstances(INeutronVPNIKEPolicyAware.class, this);
             if (instances != null) {
                 if (instances.length > 0) {
                     for (Object instance : instances) {
                         INeutronVPNIKEPolicyAware service = (INeutronVPNIKEPolicyAware) instance;
                         int status = service.canCreateNeutronVPNIKEPolicy(singleton);
-                        if (status < 200 || status > 299)
+                        if (status < 200 || status > 299) {
                             return Response.status(status).build();
+                        }
                     }
                 } else {
                     throw new ServiceUnavailableException("No providers registered.  Please try again later");
@@ -242,18 +245,21 @@ public class NeutronVPNIKEPoliciesNorthbound {
         /*
          * ikePolicy has to exist and only a single delta can be supplied
          */
-        if (!ikePolicyInterface.neutronVPNIKEPolicyExists(policyUUID))
+        if (!ikePolicyInterface.neutronVPNIKEPolicyExists(policyUUID)) {
             throw new ResourceNotFoundException("VPNIKEPolicy UUID not found");
-        if (!input.isSingleton())
+        }
+        if (!input.isSingleton()) {
             throw new BadRequestException("Only single ikePolicy deltas supported");
+        }
         NeutronVPNIKEPolicy singleton = input.getSingleton();
         NeutronVPNIKEPolicy original = ikePolicyInterface.getNeutronVPNIKEPolicy(policyUUID);
 
         /*
          * attribute changes blocked by Neutron
          */
-        if (singleton.getID() != null || singleton.getTenantID() != null)
+        if (singleton.getID() != null || singleton.getTenantID() != null) {
             throw new BadRequestException("Request attribute change not allowed");
+        }
 
         Object[] instances = NeutronUtil.getInstances(INeutronVPNIKEPolicyAware.class, this);
         if (instances != null) {
@@ -261,8 +267,9 @@ public class NeutronVPNIKEPoliciesNorthbound {
                 for (Object instance : instances) {
                     INeutronVPNIKEPolicyAware service = (INeutronVPNIKEPolicyAware) instance;
                     int status = service.canUpdateNeutronVPNIKEPolicy(singleton, original);
-                    if (status < 200 || status > 299)
+                    if (status < 200 || status > 299) {
                         return Response.status(status).build();
+                    }
                 }
             } else {
                 throw new ServiceUnavailableException("No providers registered.  Please try again later");
@@ -308,8 +315,9 @@ public class NeutronVPNIKEPoliciesNorthbound {
         /*
          * verify that the policy exists and is not in use before removing it
          */
-        if (!policyInterface.neutronVPNIKEPolicyExists(policyUUID))
+        if (!policyInterface.neutronVPNIKEPolicyExists(policyUUID)) {
             throw new ResourceNotFoundException("VPNIKEPolicy UUID not found");
+        }
         NeutronVPNIKEPolicy singleton = policyInterface.getNeutronVPNIKEPolicy(policyUUID);
         Object[] instances = NeutronUtil.getInstances(INeutronVPNIKEPolicyAware.class, this);
         if (instances != null) {
@@ -317,8 +325,9 @@ public class NeutronVPNIKEPoliciesNorthbound {
                 for (Object instance : instances) {
                     INeutronVPNIKEPolicyAware service = (INeutronVPNIKEPolicyAware) instance;
                     int status = service.canDeleteNeutronVPNIKEPolicy(singleton);
-                    if (status < 200 || status > 299)
+                    if (status < 200 || status > 299) {
                         return Response.status(status).build();
+                    }
                 }
             } else {
                 throw new ServiceUnavailableException("No providers registered.  Please try again later");
index 2e35d1150992d1ff2591edd908da36dc45d9db1c..b10041572b87733d41f9604ea33e268c2956bb87 100644 (file)
@@ -108,10 +108,11 @@ public class NeutronVPNIPSECPoliciesNorthbound {
                     (queryTransformProtocol == null || queryTransformProtocol.equals(oSS.getTransformProtocol())) &&
                     (queryEncapsulationMode == null || queryEncapsulationMode.equals(oSS.getEncapsulationMode())) &&
                     (queryTenantID == null || queryTenantID.equals(oSS.getTenantID()))) {
-                if (fields.size() > 0)
+                if (fields.size() > 0) {
                     ans.add(extractFields(oSS,fields));
-                else
+                } else {
                     ans.add(oSS);
+                }
             }
         }
         //TODO: apply pagination to results
@@ -179,16 +180,18 @@ public class NeutronVPNIPSECPoliciesNorthbound {
             /*
              * verify that the ipsecPolicy doesn't already exist (issue: is deeper inspection necessary?)
              */
-            if (ipsecPolicyInterface.neutronVPNIPSECPolicyExists(singleton.getID()))
+            if (ipsecPolicyInterface.neutronVPNIPSECPolicyExists(singleton.getID())) {
                 throw new BadRequestException("ipsecPolicy UUID already exists");
+            }
             Object[] instances = NeutronUtil.getInstances(INeutronVPNIPSECPolicyAware.class, this);
             if (instances != null) {
                 if (instances.length > 0) {
                     for (Object instance : instances) {
                         INeutronVPNIPSECPolicyAware service = (INeutronVPNIPSECPolicyAware) instance;
                         int status = service.canCreateNeutronVPNIPSECPolicy(singleton);
-                        if (status < 200 || status > 299)
+                        if (status < 200 || status > 299) {
                             return Response.status(status).build();
+                        }
                     }
                 } else {
                     throw new ServiceUnavailableException("No providers registered.  Please try again later");
@@ -242,18 +245,21 @@ public class NeutronVPNIPSECPoliciesNorthbound {
         /*
          * ipsecPolicy has to exist and only a single delta can be supplied
          */
-        if (!ipsecPolicyInterface.neutronVPNIPSECPolicyExists(policyUUID))
+        if (!ipsecPolicyInterface.neutronVPNIPSECPolicyExists(policyUUID)) {
             throw new ResourceNotFoundException("VPNIPSECPolicy UUID not found");
-        if (!input.isSingleton())
+        }
+        if (!input.isSingleton()) {
             throw new BadRequestException("Only single ipsecPolicy deltas supported");
+        }
         NeutronVPNIPSECPolicy singleton = input.getSingleton();
         NeutronVPNIPSECPolicy original = ipsecPolicyInterface.getNeutronVPNIPSECPolicy(policyUUID);
 
         /*
          * attribute changes blocked by Neutron
          */
-        if (singleton.getID() != null || singleton.getTenantID() != null)
+        if (singleton.getID() != null || singleton.getTenantID() != null) {
             throw new BadRequestException("Request attribute change not allowed");
+        }
 
         Object[] instances = NeutronUtil.getInstances(INeutronVPNIPSECPolicyAware.class, this);
         if (instances != null) {
@@ -261,8 +267,9 @@ public class NeutronVPNIPSECPoliciesNorthbound {
                 for (Object instance : instances) {
                     INeutronVPNIPSECPolicyAware service = (INeutronVPNIPSECPolicyAware) instance;
                     int status = service.canUpdateNeutronVPNIPSECPolicy(singleton, original);
-                    if (status < 200 || status > 299)
+                    if (status < 200 || status > 299) {
                         return Response.status(status).build();
+                    }
                 }
             } else {
                 throw new ServiceUnavailableException("No providers registered.  Please try again later");
@@ -308,8 +315,9 @@ public class NeutronVPNIPSECPoliciesNorthbound {
         /*
          * verify that the policy exists and is not in use before removing it
          */
-        if (!policyInterface.neutronVPNIPSECPolicyExists(policyUUID))
+        if (!policyInterface.neutronVPNIPSECPolicyExists(policyUUID)) {
             throw new ResourceNotFoundException("VPNIPSECPolicy UUID not found");
+        }
         NeutronVPNIPSECPolicy singleton = policyInterface.getNeutronVPNIPSECPolicy(policyUUID);
         Object[] instances = NeutronUtil.getInstances(INeutronVPNIPSECPolicyAware.class, this);
         if (instances != null) {
@@ -317,8 +325,9 @@ public class NeutronVPNIPSECPoliciesNorthbound {
                 for (Object instance : instances) {
                     INeutronVPNIPSECPolicyAware service = (INeutronVPNIPSECPolicyAware) instance;
                     int status = service.canDeleteNeutronVPNIPSECPolicy(singleton);
-                    if (status < 200 || status > 299)
+                    if (status < 200 || status > 299) {
                         return Response.status(status).build();
+                    }
                 }
             } else {
                 throw new ServiceUnavailableException("No providers registered.  Please try again later");
index ead03707820a229235f94b41e5a4a0ca6e497e89..205d01b0a05267a32f09e608832510567037c59c 100644 (file)
@@ -117,11 +117,13 @@ public class NeutronVPNIPSECSiteConnectionsNorthbound {
                     && (queryStatus == null || queryStatus.equals(oSS.getStatus()))
                     && (queryIkePolicyID == null || queryIkePolicyID.equals(oSS.getIkePolicyID()))
                     && (queryIpSecPolicyID == null || queryIpSecPolicyID.equals(oSS.getIpsecPolicyID()))
-                    && (queryVpnServiceID == null || queryVpnServiceID.equals(oSS.getVpnServiceID())))
-                if (fields.size() > 0)
+                    && (queryVpnServiceID == null || queryVpnServiceID.equals(oSS.getVpnServiceID()))) {
+                if (fields.size() > 0) {
                     ans.add(extractFields(oSS, fields));
-                else
+                } else {
                     ans.add(oSS);
+                }
+            }
         }
 
         // TODO: apply pagination to results
@@ -190,16 +192,18 @@ public class NeutronVPNIPSECSiteConnectionsNorthbound {
              * verify that the ipsec site connection doesn't already exist (issue: is deeper
              * inspection necessary?)
              */
-            if (ipsecSiteConnectionsInterface.neutronVPNIPSECSiteConnectionsExists(singleton.getID()))
+            if (ipsecSiteConnectionsInterface.neutronVPNIPSECSiteConnectionsExists(singleton.getID())) {
                 throw new BadRequestException("VPNIPSECSiteConnections ID already exists");
+            }
             Object[] instances = NeutronUtil.getInstances(INeutronVPNIPSECSiteConnectionAware.class, this);
             if (instances != null) {
                 if (instances.length > 0) {
                     for (Object instance : instances) {
                         INeutronVPNIPSECSiteConnectionAware service = (INeutronVPNIPSECSiteConnectionAware) instance;
                         int status = service.canCreateNeutronVPNIPSECSiteConnection(singleton);
-                        if (status < 200 || status > 299)
+                        if (status < 200 || status > 299) {
                             return Response.status(status).build();
+                        }
                     }
                 } else {
                     throw new ServiceUnavailableException("No providers registered.  Please try again later");
@@ -253,10 +257,12 @@ public class NeutronVPNIPSECSiteConnectionsNorthbound {
          * ipsecSiteConnection has to exist and only a single delta can be
          * supplied
          */
-        if (!ipsecSiteConnectionsInterface.neutronVPNIPSECSiteConnectionsExists(policyID))
+        if (!ipsecSiteConnectionsInterface.neutronVPNIPSECSiteConnectionsExists(policyID)) {
             throw new ResourceNotFoundException("VPNIPSECSiteConnections ID not found");
-        if (!input.isSingleton())
+        }
+        if (!input.isSingleton()) {
             throw new BadRequestException("Only singleton deltas supported");
+        }
         NeutronVPNIPSECSiteConnection singleton = input.getSingleton();
         NeutronVPNIPSECSiteConnection original = ipsecSiteConnectionsInterface
                 .getNeutronVPNIPSECSiteConnections(policyID);
@@ -264,8 +270,9 @@ public class NeutronVPNIPSECSiteConnectionsNorthbound {
         /*
          * attribute changes blocked by Neutron
          */
-        if (singleton.getID() != null || singleton.getTenantID() != null)
+        if (singleton.getID() != null || singleton.getTenantID() != null) {
             throw new BadRequestException("Request attribute change not allowed");
+        }
 
         Object[] instances = NeutronUtil.getInstances(INeutronVPNIKEPolicyAware.class, this);
         if (instances != null) {
@@ -273,8 +280,9 @@ public class NeutronVPNIPSECSiteConnectionsNorthbound {
                 for (Object instance : instances) {
                     INeutronVPNIPSECSiteConnectionAware service = (INeutronVPNIPSECSiteConnectionAware) instance;
                     int status = service.canUpdateNeutronVPNIPSECSiteConnection(singleton, original);
-                    if (status < 200 || status > 299)
+                    if (status < 200 || status > 299) {
                         return Response.status(status).build();
+                    }
                 }
             } else {
                 throw new ServiceUnavailableException("No providers registered.  Please try again later");
@@ -323,8 +331,9 @@ public class NeutronVPNIPSECSiteConnectionsNorthbound {
          * verify that the iSiteConnections exists and is not in use before
          * removing it
          */
-        if (!ipsecSiteConnectionsInterface.neutronVPNIPSECSiteConnectionsExists(policyID))
+        if (!ipsecSiteConnectionsInterface.neutronVPNIPSECSiteConnectionsExists(policyID)) {
             throw new ResourceNotFoundException("VPNIPSECSiteConnections ID not found");
+        }
         NeutronVPNIPSECSiteConnection singleton = ipsecSiteConnectionsInterface
                 .getNeutronVPNIPSECSiteConnections(policyID);
         Object[] instances = NeutronUtil.getInstances(INeutronVPNIPSECSiteConnectionAware.class, this);
@@ -333,8 +342,9 @@ public class NeutronVPNIPSECSiteConnectionsNorthbound {
                 for (Object instance : instances) {
                     INeutronVPNIPSECSiteConnectionAware service = (INeutronVPNIPSECSiteConnectionAware) instance;
                     int status = service.canDeleteNeutronVPNIPSECSiteConnection(singleton);
-                    if (status < 200 || status > 299)
+                    if (status < 200 || status > 299) {
                         return Response.status(status).build();
+                    }
                 }
             } else {
                 throw new ServiceUnavailableException("No providers registered.  Please try again later");
index 611db03f2c92d16f38ae3c29a3e8c702d26ded4a..ca6b9a8dac56ec7487224606c01fd90ba5a84ab5 100644 (file)
@@ -104,10 +104,11 @@ public class NeutronVPNServicesNorthbound {
                     && (querySubnetID == null || querySubnetID.equals(oSS.getSubnetUUID()))
                     && (queryRouterID == null || queryRouterID.equals(oSS.getRouterUUID()))
                     && (queryTenantID == null || queryTenantID.equals(oSS.getTenantID()))) {
-                if (fields.size() > 0)
+                if (fields.size() > 0) {
                     ans.add(extractFields(oSS, fields));
-                else
+                } else {
                     ans.add(oSS);
+                }
             }
         }