cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [6/7] git commit: updated refs/heads/4.9-bountycastle-daan to 2ac0837
Date Fri, 22 Apr 2016 12:04:26 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2ac08377/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java b/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java
index 137aa61..9cbc73a 100644
--- a/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java
+++ b/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java
@@ -27,9 +27,11 @@ import java.util.Map;
 
 import javax.naming.ConfigurationException;
 
+import org.apache.cloudstack.api.ApiConstants;
 import org.apache.commons.io.output.ByteArrayOutputStream;
 import org.apache.log4j.Logger;
-import org.bouncycastle.openssl.PEMWriter;
+import org.bouncycastle.util.io.pem.PemObject;
+import org.bouncycastle.util.io.pem.PemWriter;
 
 import com.citrix.netscaler.nitro.exception.nitro_exception;
 import com.citrix.netscaler.nitro.resource.base.base_response;
@@ -75,11 +77,6 @@ import com.citrix.netscaler.nitro.util.filtervalue;
 import com.citrix.sdx.nitro.resource.config.mps.mps;
 import com.citrix.sdx.nitro.resource.config.ns.ns;
 import com.citrix.sdx.nitro.resource.config.xen.xen_nsvpx_image;
-import com.google.common.collect.Lists;
-import com.google.gson.Gson;
-
-import org.apache.cloudstack.api.ApiConstants;
-
 import com.cloud.agent.IAgentControl;
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
@@ -127,6 +124,8 @@ import com.cloud.utils.exception.ExecutionException;
 import com.cloud.utils.net.NetUtils;
 import com.cloud.utils.security.CertificateHelper;
 import com.cloud.utils.ssh.SshHelper;
+import com.google.common.collect.Lists;
+import com.google.gson.Gson;
 
 class NitroError {
     static final int NS_RESOURCE_EXISTS = 273;
@@ -235,7 +234,7 @@ public class NetscalerResource implements ServerResource {
 
             _inline = Boolean.parseBoolean((String)params.get("inline"));
 
-            if (((String)params.get("cloudmanaged")) != null) {
+            if ((String)params.get("cloudmanaged") != null) {
                 _cloudManaged = Boolean.parseBoolean((String)params.get("cloudmanaged"));
             }
 
@@ -264,7 +263,7 @@ public class NetscalerResource implements ServerResource {
             }
 
             return true;
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new ConfigurationException(e.getMessage());
         }
     }
@@ -280,7 +279,7 @@ public class NetscalerResource implements ServerResource {
                     _netscalerSdxService.logout();
                 }
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             // Ignore logout exceptions
         }
     }
@@ -302,15 +301,15 @@ public class NetscalerResource implements ServerResource {
             } else {
                 _netscalerSdxService = new com.citrix.sdx.nitro.service.nitro_service(_ip, "https");
                 _netscalerSdxService.set_credential(_username, _password);
-                com.citrix.sdx.nitro.resource.base.login login = _netscalerSdxService.login();
+                final com.citrix.sdx.nitro.resource.base.login login = _netscalerSdxService.login();
                 if (login == null) {
                     throw new ExecutionException("Failed to log in to Netscaler SDX device at " + _ip + " due to error " + apiCallResult.errorcode + " and message " +
                             apiCallResult.message);
                 }
             }
-        } catch (nitro_exception e) {
+        } catch (final nitro_exception e) {
             throw new ExecutionException("Failed to log in to Netscaler device at " + _ip + " due to " + e.getMessage());
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new ExecutionException("Failed to log in to Netscaler device at " + _ip + " due to " + e.getMessage());
         }
     }
@@ -320,9 +319,9 @@ public class NetscalerResource implements ServerResource {
             return;
         }
         try {
-            String[] features = _netscalerService.get_enabled_features();
+            final String[] features = _netscalerService.get_enabled_features();
             if (features != null) {
-                for (String feature : features) {
+                for (final String feature : features) {
                     if (feature.equalsIgnoreCase("LB")) {
                         return;
                     }
@@ -330,15 +329,15 @@ public class NetscalerResource implements ServerResource {
             }
 
             // enable load balancing on the device
-            String[] feature = new String[1];
+            final String[] feature = new String[1];
             feature[0] = "LB";
             apiCallResult = _netscalerService.enable_features(feature);
             if (apiCallResult.errorcode != 0) {
                 throw new ExecutionException("Enabling load balancing feature on the device failed.");
             }
-        } catch (nitro_exception e) {
+        } catch (final nitro_exception e) {
             throw new ExecutionException("Enabling load balancing feature on the device failed  due to " + e.getMessage());
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new ExecutionException("Enabling load balancing feature on the device failed due to " + e.getMessage());
         }
     }
@@ -346,21 +345,21 @@ public class NetscalerResource implements ServerResource {
     private void validateInterfaces(String publicInterface, String privateInterface) throws ExecutionException {
         try {
             if (!_isSdx && !_cloudManaged) {
-                Interface publicIf = Interface.get(_netscalerService, publicInterface);
-                Interface privateIf = Interface.get(_netscalerService, privateInterface);
+                final Interface publicIf = Interface.get(_netscalerService, publicInterface);
+                final Interface privateIf = Interface.get(_netscalerService, privateInterface);
                 if (publicIf != null || privateIf != null) {
                     return;
                 } else {
                     throw new ExecutionException("Invalid interface name specified for public/private interfaces.");
                 }
             }
-        } catch (nitro_exception e) {
+        } catch (final nitro_exception e) {
             if (e.getErrorCode() == NitroError.NS_RESOURCE_NOT_EXISTS) {
                 throw new ExecutionException("Invalid interface name specified for public and private interfaces.");
             } else {
                 throw new ExecutionException("Failed to verify public interface and private intefaces are valid due to " + e.getMessage());
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new ExecutionException("Failed to verify public interface and private intefaces are valid due to " + e.getMessage());
         }
     }
@@ -368,18 +367,18 @@ public class NetscalerResource implements ServerResource {
     private void validateDeviceType(String deviceType) throws ExecutionException {
         try {
             if (!_isSdx && !_cloudManaged) {
-                nshardware nsHw = com.citrix.netscaler.nitro.resource.config.ns.nshardware.get(_netscalerService);
+                final nshardware nsHw = com.citrix.netscaler.nitro.resource.config.ns.nshardware.get(_netscalerService);
                 if (nsHw == null) {
                     throw new ExecutionException("Failed to get the hardware description of the Netscaler device at " + _ip);
                 } else {
-                    if ((_deviceName.equalsIgnoreCase("NetscalerMPXLoadBalancer") && nsHw.get_hwdescription().contains("MPX")) ||
-                            (_deviceName.equalsIgnoreCase("NetscalerVPXLoadBalancer") && nsHw.get_hwdescription().contains("NetScaler Virtual Appliance"))) {
+                    if (_deviceName.equalsIgnoreCase("NetscalerMPXLoadBalancer") && nsHw.get_hwdescription().contains("MPX") ||
+                            _deviceName.equalsIgnoreCase("NetscalerVPXLoadBalancer") && nsHw.get_hwdescription().contains("NetScaler Virtual Appliance")) {
                         return;
                     }
                     throw new ExecutionException("Netscalar device type specified does not match with the actuall device type.");
                 }
             } else if (_isSdx) {
-                mps serviceVM = mps.get(_netscalerSdxService);
+                final mps serviceVM = mps.get(_netscalerSdxService);
                 if (serviceVM != null) {
                     if (serviceVM.get_platform().contains("SDX") || serviceVM.get_product().contains("SDX")) {
                         return;
@@ -390,14 +389,14 @@ public class NetscalerResource implements ServerResource {
                     throw new ExecutionException("Failed to get the hardware details of the Netscaler device at " + _ip);
                 }
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new ExecutionException("Failed to verify device type specified when matching with actuall device type due to " + e.getMessage());
         }
     }
 
     @Override
     public StartupCommand[] initialize() {
-        StartupExternalLoadBalancerCommand cmd = new StartupExternalLoadBalancerCommand();
+        final StartupExternalLoadBalancerCommand cmd = new StartupExternalLoadBalancerCommand();
         cmd.setName(_name);
         cmd.setDataCenter(_zoneId);
         cmd.setPod("");
@@ -452,14 +451,14 @@ public class NetscalerResource implements ServerResource {
             return Answer.createUnsupportedCommandAnswer(cmd);
         }
 
-        String[] results = new String[cmd.getIpAddresses().length];
+        final String[] results = new String[cmd.getIpAddresses().length];
         int i = 0;
         try {
-            IpAddressTO[] ips = cmd.getIpAddresses();
-            for (IpAddressTO ip : ips) {
-                long guestVlanTag = Long.parseLong(ip.getBroadcastUri());
-                String vlanSelfIp = ip.getVlanGateway();
-                String vlanNetmask = ip.getVlanNetmask();
+            final IpAddressTO[] ips = cmd.getIpAddresses();
+            for (final IpAddressTO ip : ips) {
+                final long guestVlanTag = Long.parseLong(ip.getBroadcastUri());
+                final String vlanSelfIp = ip.getVlanGateway();
+                final String vlanNetmask = ip.getVlanNetmask();
 
                 if (ip.isAdd()) {
                     // Add a new guest VLAN and its subnet and bind it to private interface
@@ -471,12 +470,12 @@ public class NetscalerResource implements ServerResource {
 
                 saveConfiguration();
                 results[i++] = ip.getPublicIp() + " - success";
-                String action = ip.isAdd() ? "associate" : "remove";
+                final String action = ip.isAdd() ? "associate" : "remove";
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug("Netscaler load balancer " + _ip + " successfully executed IPAssocCommand to " + action + " IP " + ip);
                 }
             }
-        } catch (ExecutionException e) {
+        } catch (final ExecutionException e) {
             s_logger.error("Netscaler loadbalancer " + _ip + " failed to execute IPAssocCommand due to " + e.getMessage());
             if (shouldRetry(numRetries)) {
                 return retry(cmd, numRetries);
@@ -490,31 +489,31 @@ public class NetscalerResource implements ServerResource {
 
     private Answer execute(HealthCheckLBConfigCommand cmd, int numRetries) {
 
-        List<LoadBalancerTO> hcLB = new ArrayList<LoadBalancerTO>();
+        final List<LoadBalancerTO> hcLB = new ArrayList<LoadBalancerTO>();
         try {
 
             if (_isSdx) {
                 return Answer.createUnsupportedCommandAnswer(cmd);
             }
 
-            LoadBalancerTO[] loadBalancers = cmd.getLoadBalancers();
+            final LoadBalancerTO[] loadBalancers = cmd.getLoadBalancers();
 
             if (loadBalancers == null) {
                 return new HealthCheckLBConfigAnswer(hcLB);
             }
 
-            for (LoadBalancerTO loadBalancer : loadBalancers) {
-                HealthCheckPolicyTO[] healthCheckPolicies = loadBalancer.getHealthCheckPolicies();
-                if ((healthCheckPolicies != null) && (healthCheckPolicies.length > 0) && (healthCheckPolicies[0] != null)) {
-                    String nsVirtualServerName = generateNSVirtualServerName(loadBalancer.getSrcIp(), loadBalancer.getSrcPort());
+            for (final LoadBalancerTO loadBalancer : loadBalancers) {
+                final HealthCheckPolicyTO[] healthCheckPolicies = loadBalancer.getHealthCheckPolicies();
+                if (healthCheckPolicies != null && healthCheckPolicies.length > 0 && healthCheckPolicies[0] != null) {
+                    final String nsVirtualServerName = generateNSVirtualServerName(loadBalancer.getSrcIp(), loadBalancer.getSrcPort());
 
-                    com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings =
+                    final com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings =
                             com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.get(_netscalerService, nsVirtualServerName);
 
                     if (serviceBindings != null) {
-                        for (DestinationTO destination : loadBalancer.getDestinations()) {
-                            String nsServiceName = generateNSServiceName(destination.getDestIp(), destination.getDestPort());
-                            for (com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding binding : serviceBindings) {
+                        for (final DestinationTO destination : loadBalancer.getDestinations()) {
+                            final String nsServiceName = generateNSServiceName(destination.getDestIp(), destination.getDestPort());
+                            for (final com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding binding : serviceBindings) {
                                 if (nsServiceName.equalsIgnoreCase(binding.get_servicename())) {
                                     destination.setMonitorState(binding.get_curstate());
                                     break;
@@ -526,14 +525,14 @@ public class NetscalerResource implements ServerResource {
                 }
             }
 
-        } catch (ExecutionException e) {
+        } catch (final ExecutionException e) {
             s_logger.error("Failed to execute HealthCheckLBConfigCommand due to ", e);
             if (shouldRetry(numRetries)) {
                 return retry(cmd, numRetries);
             } else {
                 return new HealthCheckLBConfigAnswer(hcLB);
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             s_logger.error("Failed to execute HealthCheckLBConfigCommand due to ", e);
             if (shouldRetry(numRetries)) {
                 return retry(cmd, numRetries);
@@ -550,19 +549,19 @@ public class NetscalerResource implements ServerResource {
                 return Answer.createUnsupportedCommandAnswer(cmd);
             }
 
-            LoadBalancerTO[] loadBalancers = cmd.getLoadBalancers();
+            final LoadBalancerTO[] loadBalancers = cmd.getLoadBalancers();
             if (loadBalancers == null) {
                 return new Answer(cmd);
             }
 
-            for (LoadBalancerTO loadBalancer : loadBalancers) {
-                String srcIp = loadBalancer.getSrcIp();
-                int srcPort = loadBalancer.getSrcPort();
-                String lbProtocol = getNetScalerProtocol(loadBalancer);
-                String lbAlgorithm = loadBalancer.getAlgorithm();
-                String nsVirtualServerName = generateNSVirtualServerName(srcIp, srcPort);
-                String nsMonitorName = generateNSMonitorName(srcIp, srcPort);
-                LbSslCert sslCert = loadBalancer.getSslCert();
+            for (final LoadBalancerTO loadBalancer : loadBalancers) {
+                final String srcIp = loadBalancer.getSrcIp();
+                final int srcPort = loadBalancer.getSrcPort();
+                final String lbProtocol = getNetScalerProtocol(loadBalancer);
+                final String lbAlgorithm = loadBalancer.getAlgorithm();
+                final String nsVirtualServerName = generateNSVirtualServerName(srcIp, srcPort);
+                final String nsMonitorName = generateNSMonitorName(srcIp, srcPort);
+                final LbSslCert sslCert = loadBalancer.getSslCert();
 
                 if (loadBalancer.isAutoScaleVmGroupTO()) {
                     applyAutoScaleConfig(loadBalancer);
@@ -573,7 +572,7 @@ public class NetscalerResource implements ServerResource {
                 boolean deleteMonitor = false;
                 boolean destinationsToAdd = false;
                 boolean deleteCert = false;
-                for (DestinationTO destination : loadBalancer.getDestinations()) {
+                for (final DestinationTO destination : loadBalancer.getDestinations()) {
                     if (!destination.isRevoked()) {
                         destinationsToAdd = true;
                         break;
@@ -589,10 +588,10 @@ public class NetscalerResource implements ServerResource {
                     }
 
                     // create a new monitor
-                    HealthCheckPolicyTO[] healthCheckPolicies = loadBalancer.getHealthCheckPolicies();
-                    if ((healthCheckPolicies != null) && (healthCheckPolicies.length > 0) && (healthCheckPolicies[0] != null)) {
+                    final HealthCheckPolicyTO[] healthCheckPolicies = loadBalancer.getHealthCheckPolicies();
+                    if (healthCheckPolicies != null && healthCheckPolicies.length > 0 && healthCheckPolicies[0] != null) {
 
-                        for (HealthCheckPolicyTO healthCheckPolicyTO : healthCheckPolicies) {
+                        for (final HealthCheckPolicyTO healthCheckPolicyTO : healthCheckPolicies) {
                             if (!healthCheckPolicyTO.isRevoked()) {
                                 addLBMonitor(nsMonitorName, lbProtocol, healthCheckPolicyTO);
                                 hasMonitor = true;
@@ -604,27 +603,27 @@ public class NetscalerResource implements ServerResource {
 
                     }
 
-                    for (DestinationTO destination : loadBalancer.getDestinations()) {
+                    for (final DestinationTO destination : loadBalancer.getDestinations()) {
 
-                        String nsServerName = generateNSServerName(destination.getDestIp());
-                        String nsServiceName = generateNSServiceName(destination.getDestIp(), destination.getDestPort());
+                        final String nsServerName = generateNSServerName(destination.getDestIp());
+                        final String nsServiceName = generateNSServiceName(destination.getDestIp(), destination.getDestPort());
                         if (!destination.isRevoked()) {
                             // add a new destination to deployed load balancing rule
 
                             // add a new server
                             if (!nsServerExists(nsServerName)) {
-                                com.citrix.netscaler.nitro.resource.config.basic.server nsServer = new com.citrix.netscaler.nitro.resource.config.basic.server();
+                                final com.citrix.netscaler.nitro.resource.config.basic.server nsServer = new com.citrix.netscaler.nitro.resource.config.basic.server();
                                 nsServer.set_name(nsServerName);
                                 nsServer.set_ipaddress(destination.getDestIp());
                                 apiCallResult = com.citrix.netscaler.nitro.resource.config.basic.server.add(_netscalerService, nsServer);
-                                if ((apiCallResult.errorcode != 0) && (apiCallResult.errorcode != NitroError.NS_RESOURCE_EXISTS)) {
+                                if (apiCallResult.errorcode != 0 && apiCallResult.errorcode != NitroError.NS_RESOURCE_EXISTS) {
                                     throw new ExecutionException("Failed to add server " + destination.getDestIp() + " due to" + apiCallResult.message);
                                 }
                             }
 
                             // create a new service using the server added
                             if (!nsServiceExists(nsServiceName)) {
-                                com.citrix.netscaler.nitro.resource.config.basic.service newService = new com.citrix.netscaler.nitro.resource.config.basic.service();
+                                final com.citrix.netscaler.nitro.resource.config.basic.service newService = new com.citrix.netscaler.nitro.resource.config.basic.service();
                                 newService.set_name(nsServiceName);
                                 newService.set_port(destination.getDestPort());
                                 newService.set_servername(nsServerName);
@@ -644,7 +643,7 @@ public class NetscalerResource implements ServerResource {
 
                             //bind service to load balancing virtual server
                             if (!nsServiceBindingExists(nsVirtualServerName, nsServiceName)) {
-                                com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding svcBinding =
+                                final com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding svcBinding =
                                         new com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding();
                                 svcBinding.set_name(nsVirtualServerName);
                                 svcBinding.set_servicename(nsServiceName);
@@ -686,19 +685,19 @@ public class NetscalerResource implements ServerResource {
                                     String previousCertKeyName = null;
 
                                     if (sslCert.getChain() != null) {
-                                        List<Certificate> chainList = CertificateHelper.parseChain(sslCert.getChain());
+                                        final List<Certificate> chainList = CertificateHelper.parseChain(sslCert.getChain());
                                         // go from ROOT to intermediate CAs
-                                        for (Certificate intermediateCert : Lists.reverse(chainList)) {
+                                        for (final Certificate intermediateCert : Lists.reverse(chainList)) {
 
-                                            String fingerPrint = CertificateHelper.generateFingerPrint(intermediateCert);
-                                            String intermediateCertKeyName = generateSslCertKeyName(fingerPrint);
-                                            String intermediateCertFileName = intermediateCertKeyName + ".pem";
+                                            final String fingerPrint = CertificateHelper.generateFingerPrint(intermediateCert);
+                                            final String intermediateCertKeyName = generateSslCertKeyName(fingerPrint);
+                                            final String intermediateCertFileName = intermediateCertKeyName + ".pem";
 
                                             if (!SSL.isSslCertKeyPresent(_netscalerService, intermediateCertKeyName)) {
-                                                intermediateCert.getEncoded();
-                                                StringWriter textWriter = new StringWriter();
-                                                PEMWriter pemWriter = new PEMWriter(textWriter);
-                                                pemWriter.writeObject(intermediateCert);
+                                                final PemObject pemObject = new PemObject(intermediateCert.getType(), intermediateCert.getEncoded());
+                                                final StringWriter textWriter = new StringWriter();
+                                                final PemWriter pemWriter = new PemWriter(textWriter);
+                                                pemWriter.writeObject(pemObject);
                                                 pemWriter.flush();
 
                                                 SSL.uploadCert(_ip, _username, _password, intermediateCertFileName, textWriter.toString().getBytes());
@@ -713,11 +712,11 @@ public class NetscalerResource implements ServerResource {
                                         }
                                     }
 
-                                    String certFilename = generateSslCertName(sslCert.getFingerprint()) + ".pem"; //netscaler uses ".pem" format for "bundle" files
-                                    String keyFilename = generateSslKeyName(sslCert.getFingerprint()) + ".pem"; //netscaler uses ".pem" format for "bundle" files
-                                    String certKeyName = generateSslCertKeyName(sslCert.getFingerprint());
+                                    final String certFilename = generateSslCertName(sslCert.getFingerprint()) + ".pem"; //netscaler uses ".pem" format for "bundle" files
+                                    final String keyFilename = generateSslKeyName(sslCert.getFingerprint()) + ".pem"; //netscaler uses ".pem" format for "bundle" files
+                                    final String certKeyName = generateSslCertKeyName(sslCert.getFingerprint());
 
-                                    ByteArrayOutputStream certDataStream = new ByteArrayOutputStream();
+                                    final ByteArrayOutputStream certDataStream = new ByteArrayOutputStream();
                                     certDataStream.write(sslCert.getCert().getBytes());
 
                                     if (!SSL.isSslCertKeyPresent(_netscalerService, certKeyName)) {
@@ -743,10 +742,10 @@ public class NetscalerResource implements ServerResource {
 
                         } else {
                             // remove a destination from the deployed load balancing rule
-                            com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings =
+                            final com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings =
                                     com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.get(_netscalerService, nsVirtualServerName);
                             if (serviceBindings != null) {
-                                for (com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding binding : serviceBindings) {
+                                for (final com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding binding : serviceBindings) {
                                     if (nsServiceName.equalsIgnoreCase(binding.get_servicename())) {
                                         // delete the binding
                                         apiCallResult = com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.delete(_netscalerService, binding);
@@ -765,8 +764,8 @@ public class NetscalerResource implements ServerResource {
                                         }
 
                                         // delete the server if there is no associated services
-                                        server_service_binding[] services = server_service_binding.get(_netscalerService, nsServerName);
-                                        if ((services == null) || (services.length == 0)) {
+                                        final server_service_binding[] services = server_service_binding.get(_netscalerService, nsServerName);
+                                        if (services == null || services.length == 0) {
                                             apiCallResult = com.citrix.netscaler.nitro.resource.config.basic.server.delete(_netscalerService, nsServerName);
                                             if (apiCallResult.errorcode != 0) {
                                                 throw new ExecutionException("Failed to remove server:" + nsServerName + " due to " + apiCallResult.message);
@@ -779,24 +778,24 @@ public class NetscalerResource implements ServerResource {
                     }
                 } else {
                     // delete the implemented load balancing rule and its destinations
-                    lbvserver lbserver = getVirtualServerIfExisits(nsVirtualServerName);
+                    final lbvserver lbserver = getVirtualServerIfExisits(nsVirtualServerName);
                     if (lbserver != null) {
                         //unbind the all services associated with this virtual server
-                        com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings =
+                        final com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding[] serviceBindings =
                                 com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.get(_netscalerService, nsVirtualServerName);
 
                         if (serviceBindings != null) {
-                            for (com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding binding : serviceBindings) {
-                                String serviceName = binding.get_servicename();
+                            for (final com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding binding : serviceBindings) {
+                                final String serviceName = binding.get_servicename();
                                 apiCallResult = com.citrix.netscaler.nitro.resource.config.lb.lbvserver_service_binding.delete(_netscalerService, binding);
                                 if (apiCallResult.errorcode != 0) {
                                     throw new ExecutionException("Failed to unbind service from the lb virtual server: " + nsVirtualServerName + " due to " +
                                             apiCallResult.message);
                                 }
 
-                                com.citrix.netscaler.nitro.resource.config.basic.service svc =
+                                final com.citrix.netscaler.nitro.resource.config.basic.service svc =
                                         com.citrix.netscaler.nitro.resource.config.basic.service.get(_netscalerService, serviceName);
-                                String nsServerName = svc.get_servername();
+                                final String nsServerName = svc.get_servername();
 
                                 // check if service is bound to any other virtual server
                                 if (!isServiceBoundToVirtualServer(serviceName)) {
@@ -808,8 +807,8 @@ public class NetscalerResource implements ServerResource {
                                 }
 
                                 //delete the server if no more services attached
-                                server_service_binding[] services = server_service_binding.get(_netscalerService, nsServerName);
-                                if ((services == null) || (services.length == 0)) {
+                                final server_service_binding[] services = server_service_binding.get(_netscalerService, nsServerName);
+                                if (services == null || services.length == 0) {
                                     apiCallResult = com.citrix.netscaler.nitro.resource.config.basic.server.delete(_netscalerService, nsServerName);
                                     if (apiCallResult.errorcode != 0) {
                                         throw new ExecutionException("Failed to remove server:" + nsServerName + " due to " + apiCallResult.message);
@@ -827,9 +826,9 @@ public class NetscalerResource implements ServerResource {
                 }
                 if (sslCert != null && deleteCert) {
 
-                    String certFilename = generateSslCertName(sslCert.getFingerprint()) + ".pem"; //netscaler uses ".pem" format for "bundle" files
-                    String keyFilename = generateSslKeyName(sslCert.getFingerprint()) + ".pem"; //netscaler uses ".pem" format for "bundle" files
-                    String certKeyName = generateSslCertKeyName(sslCert.getFingerprint());
+                    final String certFilename = generateSslCertName(sslCert.getFingerprint()) + ".pem"; //netscaler uses ".pem" format for "bundle" files
+                    final String keyFilename = generateSslKeyName(sslCert.getFingerprint()) + ".pem"; //netscaler uses ".pem" format for "bundle" files
+                    final String certKeyName = generateSslCertKeyName(sslCert.getFingerprint());
 
                     // unbind before deleting
                     if (nsVirtualServerExists(nsVirtualServerName) &&
@@ -852,13 +851,13 @@ public class NetscalerResource implements ServerResource {
                      */
 
                     if (sslCert.getChain() != null) {
-                        List<Certificate> chainList = CertificateHelper.parseChain(sslCert.getChain());
+                        final List<Certificate> chainList = CertificateHelper.parseChain(sslCert.getChain());
                         //go from intermediate CAs to ROOT
-                        for (Certificate intermediateCert : chainList) {
+                        for (final Certificate intermediateCert : chainList) {
 
-                            String fingerPrint = CertificateHelper.generateFingerPrint(intermediateCert);
-                            String intermediateCertKeyName = generateSslCertKeyName(fingerPrint);
-                            String intermediateCertFileName = intermediateCertKeyName + ".pem";
+                            final String fingerPrint = CertificateHelper.generateFingerPrint(intermediateCert);
+                            final String intermediateCertKeyName = generateSslCertKeyName(fingerPrint);
+                            final String intermediateCertFileName = intermediateCertKeyName + ".pem";
 
                             if (SSL.isSslCertKeyPresent(_netscalerService, intermediateCertKeyName) &&
                                     !SSL.isCaforCerts(_netscalerService, intermediateCertKeyName)) {
@@ -880,14 +879,14 @@ public class NetscalerResource implements ServerResource {
 
             saveConfiguration();
             return new Answer(cmd);
-        } catch (ExecutionException e) {
+        } catch (final ExecutionException e) {
             s_logger.error("Failed to execute LoadBalancerConfigCommand due to ", e);
             if (shouldRetry(numRetries)) {
                 return retry(cmd, numRetries);
             } else {
                 return new Answer(cmd, e);
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             s_logger.error("Failed to execute LoadBalancerConfigCommand due to ", e);
             if (shouldRetry(numRetries)) {
                 return retry(cmd, numRetries);
@@ -904,11 +903,11 @@ public class NetscalerResource implements ServerResource {
         }
 
         try {
-            String vpxName = "Cloud-VPX-" + cmd.getLoadBalancerIP();
-            String username = "admin";
-            String password = "admin";
+            final String vpxName = "Cloud-VPX-" + cmd.getLoadBalancerIP();
+            final String username = "admin";
+            final String password = "admin";
 
-            ns ns_obj = new ns();
+            final ns ns_obj = new ns();
             ns_obj.set_name(vpxName);
             ns_obj.set_ip_address(cmd.getLoadBalancerIP());
             ns_obj.set_netmask(cmd.getNetmask());
@@ -926,12 +925,12 @@ public class NetscalerResource implements ServerResource {
 
             // use the first VPX image of the available VPX images on the SDX to create an instance of VPX
             // TODO: should enable the option to choose the template while adding the SDX device in to CloudStack
-            xen_nsvpx_image[] vpxImages = xen_nsvpx_image.get(_netscalerSdxService);
+            final xen_nsvpx_image[] vpxImages = xen_nsvpx_image.get(_netscalerSdxService);
             if (!(vpxImages != null && vpxImages.length >= 1)) {
                 new Answer(cmd, new ExecutionException("Failed to create VPX instance on the netscaler SDX device " + _ip +
                         " as there are no VPX images on SDX to use for creating VPX."));
             }
-            String imageName = vpxImages[0].get_file_name();
+            final String imageName = vpxImages[0].get_file_name();
             ns_obj.set_image_name(imageName);
 
             String publicIf = _publicInterface;
@@ -949,14 +948,14 @@ public class NetscalerResource implements ServerResource {
 
             // wait for VPX instance to start-up
             long startTick = System.currentTimeMillis();
-            long startWaitMilliSeconds = 600000;
+            final long startWaitMilliSeconds = 600000;
             while (!newVpx.get_instance_state().equalsIgnoreCase("up") && System.currentTimeMillis() - startTick < startWaitMilliSeconds) {
                 try {
                     Thread.sleep(10000);
-                } catch (InterruptedException e) {
+                } catch (final InterruptedException e) {
                     s_logger.debug("[ignored] interupted while waiting for netscaler to be 'up'.");
                 }
-                ns refreshNsObj = new ns();
+                final ns refreshNsObj = new ns();
                 refreshNsObj.set_id(newVpx.get_id());
                 newVpx = ns.get(_netscalerSdxService, refreshNsObj);
             }
@@ -969,19 +968,19 @@ public class NetscalerResource implements ServerResource {
             // wait till NS service in side VPX is actually ready
             startTick = System.currentTimeMillis();
             boolean nsServiceUp = false;
-            long nsServiceWaitMilliSeconds = 60000;
+            final long nsServiceWaitMilliSeconds = 60000;
             while (System.currentTimeMillis() - startTick < nsServiceWaitMilliSeconds) {
                 try {
-                    nitro_service _netscalerService = new nitro_service(cmd.getLoadBalancerIP(), "https");
-                    _netscalerService.set_certvalidation(false);
-                    _netscalerService.set_hostnameverification(false);
-                    _netscalerService.set_credential(username, password);
-                    apiCallResult = _netscalerService.login();
+                    final nitro_service netscalerService = new nitro_service(cmd.getLoadBalancerIP(), "https");
+                    netscalerService.set_certvalidation(false);
+                    netscalerService.set_hostnameverification(false);
+                    netscalerService.set_credential(username, password);
+                    apiCallResult = netscalerService.login();
                     if (apiCallResult.errorcode == 0) {
                         nsServiceUp = true;
                         break;
                     }
-                } catch (Exception e) {
+                } catch (final Exception e) {
                     Thread.sleep(10000);
                     continue;
                 }
@@ -999,8 +998,8 @@ public class NetscalerResource implements ServerResource {
             // However the VPX instances created will have interface range start from 10/1 but will only have as many interfaces enabled while creating the VPX instance
             // So due to this, we need to map public & private interface on SDX to correct public & private interface of VPX
 
-            int publicIfnum = Integer.parseInt(_publicInterface.substring(_publicInterface.lastIndexOf("/") + 1));
-            int privateIfnum = Integer.parseInt(_privateInterface.substring(_privateInterface.lastIndexOf("/") + 1));
+            final int publicIfnum = Integer.parseInt(_publicInterface.substring(_publicInterface.lastIndexOf("/") + 1));
+            final int privateIfnum = Integer.parseInt(_privateInterface.substring(_privateInterface.lastIndexOf("/") + 1));
 
             if (_publicInterface.startsWith("10/") && _privateInterface.startsWith("10/")) {
                 if (publicIfnum == privateIfnum) {
@@ -1034,7 +1033,7 @@ public class NetscalerResource implements ServerResource {
 
             return new CreateLoadBalancerApplianceAnswer(cmd, true, "provisioned VPX instance", "NetscalerVPXLoadBalancer", "Netscaler", new NetscalerResource(),
                     publicIf, privateIf, _username, _password);
-        } catch (Exception e) {
+        } catch (final Exception e) {
             if (shouldRetry(numRetries)) {
                 return retry(cmd, numRetries);
             }
@@ -1045,15 +1044,15 @@ public class NetscalerResource implements ServerResource {
 
     private Answer execute(GlobalLoadBalancerConfigCommand gslbCmd, int numRetries) {
 
-        String lbMethod = gslbCmd.getLoadBalancerMethod();
-        String persistenceType = gslbCmd.getPersistenceType();
-        String serviceType = gslbCmd.getServiceType();
-        boolean forRevoke = gslbCmd.isForRevoke();
-        long gslbId = gslbCmd.getGslbId();
-        List<SiteLoadBalancerConfig> sites = gslbCmd.getSiteDetails();
+        final String lbMethod = gslbCmd.getLoadBalancerMethod();
+        final String persistenceType = gslbCmd.getPersistenceType();
+        final String serviceType = gslbCmd.getServiceType();
+        final boolean forRevoke = gslbCmd.isForRevoke();
+        final long gslbId = gslbCmd.getGslbId();
+        final List<SiteLoadBalancerConfig> sites = gslbCmd.getSiteDetails();
 
-        String domainName = gslbCmd.getDomainName();
-        String vserverName = GSLB.generateVirtualServerName(domainName);
+        final String domainName = gslbCmd.getDomainName();
+        final String vserverName = GSLB.generateVirtualServerName(domainName);
 
         try {
 
@@ -1063,17 +1062,17 @@ public class NetscalerResource implements ServerResource {
                 GSLB.createVirtualServer(_netscalerService, vserverName, lbMethod, persistenceType, gslbId, serviceType);
 
                 if (sites != null) { // check if there are any sites that are participating in global load balancing
-                    for (SiteLoadBalancerConfig site : sites) {
+                    for (final SiteLoadBalancerConfig site : sites) {
 
-                        String sitePrivateIP = site.getGslbProviderPrivateIp();
-                        String sitePublicIP = site.getGslbProviderPublicIp();
-                        String servicePublicIp = site.getServicePublicIp();
-                        String servicePublicPort = site.getServicePort();
-                        String siteName = GSLB.generateUniqueSiteName(sitePrivateIP, sitePublicIP, site.getDataCenterId());
+                        final String sitePrivateIP = site.getGslbProviderPrivateIp();
+                        final String sitePublicIP = site.getGslbProviderPublicIp();
+                        final String servicePublicIp = site.getServicePublicIp();
+                        final String servicePublicPort = site.getServicePort();
+                        final String siteName = GSLB.generateUniqueSiteName(sitePrivateIP, sitePublicIP, site.getDataCenterId());
 
                         // Add/Delete GSLB local and remote sites that are part of GSLB virtual server
                         if (!site.forRevoke()) {
-                            String siteType = (site.isLocal()) ? "LOCAL" : "REMOTE";
+                            final String siteType = site.isLocal() ? "LOCAL" : "REMOTE";
                             if (GSLB.getSiteObject(_netscalerService, siteName) != null) {
                                 GSLB.updateSite(_netscalerService, siteType, siteName, site.getGslbProviderPrivateIp(), site.getGslbProviderPublicIp());
                             } else {
@@ -1082,8 +1081,8 @@ public class NetscalerResource implements ServerResource {
                         }
 
                         // Add/Delete GSLB service corresponding the service running on each site
-                        String serviceName = GSLB.generateUniqueServiceName(siteName, servicePublicIp, servicePublicPort);
-                        String monitorName = GSLB.generateGslbServiceMonitorName(servicePublicIp);
+                        final String serviceName = GSLB.generateUniqueServiceName(siteName, servicePublicIp, servicePublicPort);
+                        final String monitorName = GSLB.generateGslbServiceMonitorName(servicePublicIp);
                         if (!site.forRevoke()) {
                             // create a 'gslbservice' object
                             GSLB.createService(_netscalerService, serviceName, site.getServiceType(), servicePublicIp, servicePublicPort, siteName);
@@ -1127,15 +1126,15 @@ public class NetscalerResource implements ServerResource {
                 GSLB.deleteVserverDomainBinding(_netscalerService, vserverName, domainName);
 
                 if (sites != null) {
-                    for (SiteLoadBalancerConfig site : sites) {
+                    for (final SiteLoadBalancerConfig site : sites) {
 
-                        String sitePrivateIP = site.getGslbProviderPrivateIp();
-                        String sitePublicIP = site.getGslbProviderPublicIp();
-                        String servicePublicIp = site.getServicePublicIp();
-                        String servicePublicPort = site.getServicePort();
-                        String siteName = GSLB.generateUniqueSiteName(sitePrivateIP, sitePublicIP, site.getDataCenterId());
-                        String serviceName = GSLB.generateUniqueServiceName(siteName, servicePublicIp, servicePublicPort);
-                        String monitorName = GSLB.generateGslbServiceMonitorName(servicePublicIp);
+                        final String sitePrivateIP = site.getGslbProviderPrivateIp();
+                        final String sitePublicIP = site.getGslbProviderPublicIp();
+                        final String servicePublicIp = site.getServicePublicIp();
+                        final String servicePublicPort = site.getServicePort();
+                        final String siteName = GSLB.generateUniqueSiteName(sitePrivateIP, sitePublicIP, site.getDataCenterId());
+                        final String serviceName = GSLB.generateUniqueServiceName(siteName, servicePublicIp, servicePublicPort);
+                        final String monitorName = GSLB.generateGslbServiceMonitorName(servicePublicIp);
 
                         // delete GSLB service and GSLB monitor binding
                         GSLB.deleteGslbServiceGslbMonitorBinding(_netscalerService, monitorName, serviceName);
@@ -1160,8 +1159,8 @@ public class NetscalerResource implements ServerResource {
 
             saveConfiguration();
 
-        } catch (Exception e) {
-            String errMsg = "Failed to apply GSLB configuration due to " + e.getMessage();
+        } catch (final Exception e) {
+            final String errMsg = "Failed to apply GSLB configuration due to " + e.getMessage();
             if (shouldRetry(numRetries)) {
                 return retry(gslbCmd, numRetries);
             }
@@ -1194,7 +1193,7 @@ public class NetscalerResource implements ServerResource {
                     isUpdateSite = true;
                 }
 
-                assert ("LOCAL".equalsIgnoreCase(siteType) || "REMOTE".equalsIgnoreCase(siteType));
+                assert "LOCAL".equalsIgnoreCase(siteType) || "REMOTE".equalsIgnoreCase(siteType);
                 site.set_sitetype(siteType);
                 site.set_sitename(siteName);
                 site.set_siteipaddress(siteIP);
@@ -1210,8 +1209,8 @@ public class NetscalerResource implements ServerResource {
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug("Successfully created GSLB site: " + siteName);
                 }
-            } catch (Exception e) {
-                String errMsg = "Failed to create GSLB site: " + siteName + " due to " + e.getMessage();
+            } catch (final Exception e) {
+                final String errMsg = "Failed to create GSLB site: " + siteName + " due to " + e.getMessage();
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
                 }
@@ -1222,9 +1221,9 @@ public class NetscalerResource implements ServerResource {
         // delete 'gslbsite' object representing a site
         private static void deleteSite(nitro_service client, String siteName) throws ExecutionException {
             try {
-                gslbsite site = getSiteObject(client, siteName);
+                final gslbsite site = getSiteObject(client, siteName);
                 if (site != null) {
-                    gslbsite_gslbservice_binding[] serviceBindings = gslbsite_gslbservice_binding.get(client, siteName);
+                    final gslbsite_gslbservice_binding[] serviceBindings = gslbsite_gslbservice_binding.get(client, siteName);
                     if (serviceBindings != null && serviceBindings.length > 0) {
                         if (s_logger.isDebugEnabled()) {
                             s_logger.debug("There are services associated with GSLB site: " + siteName + " so ignoring site deletion");
@@ -1239,8 +1238,8 @@ public class NetscalerResource implements ServerResource {
                         s_logger.warn("Ignoring delete request for non existing  GSLB site: " + siteName);
                     }
                 }
-            } catch (Exception e) {
-                String errMsg = "Failed to delete GSLB site: " + siteName + " due to " + e.getMessage();
+            } catch (final Exception e) {
+                final String errMsg = "Failed to delete GSLB site: " + siteName + " due to " + e.getMessage();
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
                 }
@@ -1259,7 +1258,7 @@ public class NetscalerResource implements ServerResource {
                     }
                     return;
                 }
-                assert ("LOCAL".equalsIgnoreCase(siteType) || "REMOTE".equalsIgnoreCase(siteType));
+                assert "LOCAL".equalsIgnoreCase(siteType) || "REMOTE".equalsIgnoreCase(siteType);
                 site.set_sitetype(siteType);
                 site.set_sitename(siteName);
                 site.set_siteipaddress(siteIP);
@@ -1273,8 +1272,8 @@ public class NetscalerResource implements ServerResource {
                     s_logger.debug("Successfully updated GSLB site: " + siteName);
                 }
 
-            } catch (Exception e) {
-                String errMsg = "Failed to update GSLB site: " + siteName + " due to " + e.getMessage();
+            } catch (final Exception e) {
+                final String errMsg = "Failed to update GSLB site: " + siteName + " due to " + e.getMessage();
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
                 }
@@ -1328,8 +1327,8 @@ public class NetscalerResource implements ServerResource {
                     s_logger.debug("Successfully added GSLB virtual server: " + vserverName);
                 }
 
-            } catch (Exception e) {
-                String errMsg = "Failed to add GSLB virtual server: " + vserverName + " due to " + e.getMessage();
+            } catch (final Exception e) {
+                final String errMsg = "Failed to add GSLB virtual server: " + vserverName + " due to " + e.getMessage();
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
                 }
@@ -1340,7 +1339,7 @@ public class NetscalerResource implements ServerResource {
         // delete 'gslbvserver' object representing a globally load balanced service
         private static void deleteVirtualServer(nitro_service client, String vserverName) throws ExecutionException {
             try {
-                gslbvserver vserver = getVserverObject(client, vserverName);
+                final gslbvserver vserver = getVserverObject(client, vserverName);
                 if (vserver != null) {
                     gslbvserver.delete(client, vserver);
                     if (s_logger.isDebugEnabled()) {
@@ -1351,63 +1350,8 @@ public class NetscalerResource implements ServerResource {
                         s_logger.warn("Ignoring delete request for non existing  GSLB virtual server: " + vserverName);
                     }
                 }
-            } catch (Exception e) {
-                String errMsg = "Failed to delete GSLB virtual server: " + vserverName + " due to " + e.getMessage();
-                if (s_logger.isDebugEnabled()) {
-                    s_logger.debug(errMsg);
-                }
-                throw new ExecutionException(errMsg);
-            }
-        }
-
-        // enable 'gslbvserver' object representing a globally load balanced service
-        private static void enableVirtualServer(nitro_service client, String vserverName) throws ExecutionException {
-            try {
-                gslbvserver vserver = getVserverObject(client, vserverName);
-                if (vserver != null) {
-                    gslbvserver.enable(client, vserver);
-                }
-            } catch (Exception e) {
-                String errMsg = "Failed to enable GSLB virtual server: " + vserverName + " due to " + e.getMessage();
-                if (s_logger.isDebugEnabled()) {
-                    s_logger.debug(errMsg);
-                }
-                throw new ExecutionException(errMsg);
-            }
-        }
-
-        // disable 'gslbvserver' object representing a globally load balanced service
-        private static void disableVirtualServer(nitro_service client, String vserverName) throws ExecutionException {
-            try {
-                gslbvserver vserver = getVserverObject(client, vserverName);
-                if (vserver != null) {
-                    gslbvserver.disable(client, vserver);
-                }
-            } catch (Exception e) {
-                String errMsg = "Failed to disable GSLB virtual server: " + vserverName + " due to " + e.getMessage();
-                if (s_logger.isDebugEnabled()) {
-                    s_logger.debug(errMsg);
-                }
-                throw new ExecutionException(errMsg);
-            }
-        }
-
-        // update 'gslbvserver' object representing a globally load balanced service
-        private static void updateVirtualServer(nitro_service client, String vserverName, String lbMethod, String persistenceType, String serviceType)
-                throws ExecutionException {
-            try {
-                gslbvserver vServer = getVserverObject(client, vserverName);
-                if (vServer != null) {
-                    vServer.set_lbmethod(lbMethod);
-                    vServer.set_persistencetype(persistenceType);
-                    vServer.set_servicetype(serviceType);
-                    gslbvserver.update(client, vServer);
-                    if (s_logger.isDebugEnabled()) {
-                        s_logger.debug("Successfully updated GSLB virtual server: " + vserverName);
-                    }
-                }
-            } catch (Exception e) {
-                String errMsg = "Failed to update GSLB virtual server: " + vserverName + " due to " + e.getMessage();
+            } catch (final Exception e) {
+                final String errMsg = "Failed to delete GSLB virtual server: " + vserverName + " due to " + e.getMessage();
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
                 }
@@ -1421,15 +1365,15 @@ public class NetscalerResource implements ServerResource {
             try {
                 gslbservice service;
                 service = getServiceObject(client, serviceName);
-                String gslbServerName = generateGslbServerName(serviceIp);
+                final String gslbServerName = generateGslbServerName(serviceIp);
 
                 if (!gslbServerExists(client, gslbServerName)) {
                     base_response apiCallResult;
-                    com.citrix.netscaler.nitro.resource.config.basic.server nsServer = new com.citrix.netscaler.nitro.resource.config.basic.server();
+                    final com.citrix.netscaler.nitro.resource.config.basic.server nsServer = new com.citrix.netscaler.nitro.resource.config.basic.server();
                     nsServer.set_name(gslbServerName);
                     nsServer.set_ipaddress(serviceIp);
                     apiCallResult = com.citrix.netscaler.nitro.resource.config.basic.server.add(client, nsServer);
-                    if ((apiCallResult.errorcode != 0) && (apiCallResult.errorcode != NitroError.NS_RESOURCE_EXISTS)) {
+                    if (apiCallResult.errorcode != 0 && apiCallResult.errorcode != NitroError.NS_RESOURCE_EXISTS) {
                         throw new ExecutionException("Failed to add server " + gslbServerName + " due to" + apiCallResult.message);
                     }
                 }
@@ -1443,7 +1387,7 @@ public class NetscalerResource implements ServerResource {
 
                 service.set_sitename(siteName);
                 service.set_servername(gslbServerName);
-                int port = Integer.parseInt(servicePort);
+                final int port = Integer.parseInt(servicePort);
                 service.set_port(port);
                 service.set_servicename(serviceName);
                 service.set_servicetype(serviceType);
@@ -1457,8 +1401,8 @@ public class NetscalerResource implements ServerResource {
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug("Successfully created service: " + serviceName + " at site: " + siteName);
                 }
-            } catch (Exception e) {
-                String errMsg = "Failed to created service: " + serviceName + " at site: " + siteName + " due to " + e.getMessage();
+            } catch (final Exception e) {
+                final String errMsg = "Failed to created service: " + serviceName + " at site: " + siteName + " due to " + e.getMessage();
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
                 }
@@ -1468,7 +1412,7 @@ public class NetscalerResource implements ServerResource {
 
         private static void deleteService(nitro_service client, String serviceName) throws ExecutionException {
             try {
-                gslbservice service = getServiceObject(client, serviceName);
+                final gslbservice service = getServiceObject(client, serviceName);
                 if (service != null) {
                     gslbservice.delete(client, serviceName);
                     if (s_logger.isDebugEnabled()) {
@@ -1479,34 +1423,8 @@ public class NetscalerResource implements ServerResource {
                         s_logger.warn("Ignoring delete request for non existing  service: " + serviceName);
                     }
                 }
-            } catch (Exception e) {
-                String errMsg = "Failed to delete service: " + serviceName + " due to " + e.getMessage();
-                if (s_logger.isDebugEnabled()) {
-                    s_logger.debug(errMsg);
-                }
-                throw new ExecutionException(errMsg);
-            }
-        }
-
-        private static void updateService(nitro_service client, String serviceName, String serviceType, String publicIp, String publicPort, String siteName)
-                throws ExecutionException {
-            try {
-                gslbservice service;
-                service = getServiceObject(client, serviceName);
-
-                if (service != null) {
-                    service.set_sitename(siteName);
-                    service.set_publicip(publicIp);
-                    service.set_publicport(Integer.getInteger(publicPort));
-                    service.set_servicename(serviceName);
-                    service.set_servicetype(serviceType);
-                    gslbservice.update(client, service);
-                    if (s_logger.isDebugEnabled()) {
-                        s_logger.debug("Successfully updated service: " + serviceName + " at site: " + siteName);
-                    }
-                }
-            } catch (Exception e) {
-                String errMsg = "Failed to update service: " + serviceName + " at site: " + siteName + "due to " + e.getMessage();
+            } catch (final Exception e) {
+                final String errMsg = "Failed to delete service: " + serviceName + " due to " + e.getMessage();
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
                 }
@@ -1517,8 +1435,8 @@ public class NetscalerResource implements ServerResource {
         private static void createVserverServiceBinding(nitro_service client, String serviceName, String vserverName, long weight) throws ExecutionException {
             String errMsg;
             try {
-                assert (weight >= 1 && weight <= 100);
-                gslbvserver_gslbservice_binding binding = new gslbvserver_gslbservice_binding();
+                assert weight >= 1 && weight <= 100;
+                final gslbvserver_gslbservice_binding binding = new gslbvserver_gslbservice_binding();
                 binding.set_name(vserverName);
                 binding.set_servicename(serviceName);
                 binding.set_weight(weight);
@@ -1526,7 +1444,7 @@ public class NetscalerResource implements ServerResource {
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug("Successfully created service: " + serviceName + " and virtual server: " + vserverName + " binding");
                 }
-            } catch (nitro_exception ne) {
+            } catch (final nitro_exception ne) {
                 if (ne.getErrorCode() == 273) {
                     return;
                 }
@@ -1535,7 +1453,7 @@ public class NetscalerResource implements ServerResource {
                     s_logger.debug(errMsg);
                 }
                 throw new ExecutionException(errMsg);
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 errMsg = "Failed to create service: " + serviceName + " and virtual server: " + vserverName + " binding due to " + e.getMessage();
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
@@ -1546,9 +1464,9 @@ public class NetscalerResource implements ServerResource {
 
         private static void deleteVserverServiceBinding(nitro_service client, String serviceName, String vserverName) throws ExecutionException {
             try {
-                gslbvserver_gslbservice_binding[] bindings = gslbvserver_gslbservice_binding.get(client, vserverName);
+                final gslbvserver_gslbservice_binding[] bindings = gslbvserver_gslbservice_binding.get(client, vserverName);
                 if (bindings != null) {
-                    for (gslbvserver_gslbservice_binding binding : bindings) {
+                    for (final gslbvserver_gslbservice_binding binding : bindings) {
                         if (binding.get_servicename().equalsIgnoreCase(serviceName) && binding.get_name().equals(vserverName)) {
                             gslbvserver_gslbservice_binding.delete(client, binding);
                             if (s_logger.isDebugEnabled()) {
@@ -1558,8 +1476,8 @@ public class NetscalerResource implements ServerResource {
                         }
                     }
                 }
-            } catch (Exception e) {
-                String errMsg = "Failed to create service: " + serviceName + " and virtual server: " + vserverName + " binding due to " + e.getMessage();
+            } catch (final Exception e) {
+                final String errMsg = "Failed to create service: " + serviceName + " and virtual server: " + vserverName + " binding due to " + e.getMessage();
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
                 }
@@ -1571,7 +1489,7 @@ public class NetscalerResource implements ServerResource {
         private static void createVserverDomainBinding(nitro_service client, String vserverName, String domainName) throws ExecutionException {
             String errMsg;
             try {
-                gslbvserver_domain_binding binding = new gslbvserver_domain_binding();
+                final gslbvserver_domain_binding binding = new gslbvserver_domain_binding();
                 binding.set_domainname(domainName);
                 binding.set_name(vserverName);
                 gslbvserver_domain_binding.add(client, binding);
@@ -1579,12 +1497,12 @@ public class NetscalerResource implements ServerResource {
                     s_logger.debug("Successfully added virtual server: " + vserverName + " domain name: " + domainName + " binding");
                 }
                 return;
-            } catch (nitro_exception e) {
+            } catch (final nitro_exception e) {
                 if (e.getErrorCode() == NitroError.NS_GSLB_DOMAIN_ALREADY_BOUND) {
                     return;
                 }
                 errMsg = e.getMessage();
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 errMsg = e.getMessage();
             }
             errMsg = "Failed to create virtual server: " + vserverName + " domain name: " + domainName + " binding" + errMsg;
@@ -1596,9 +1514,9 @@ public class NetscalerResource implements ServerResource {
 
         private static void deleteVserverDomainBinding(nitro_service client, String vserverName, String domainName) throws ExecutionException {
             try {
-                gslbvserver_domain_binding[] bindings = gslbvserver_domain_binding.get(client, vserverName);
+                final gslbvserver_domain_binding[] bindings = gslbvserver_domain_binding.get(client, vserverName);
                 if (bindings != null) {
-                    for (gslbvserver_domain_binding binding : bindings) {
+                    for (final gslbvserver_domain_binding binding : bindings) {
                         if (binding.get_domainname().equalsIgnoreCase(domainName)) {
                             gslbvserver_domain_binding.delete(client, binding);
                             if (s_logger.isDebugEnabled()) {
@@ -1608,8 +1526,8 @@ public class NetscalerResource implements ServerResource {
                         }
                     }
                 }
-            } catch (Exception e) {
-                String errMsg = "Failed to delete virtual server: " + vserverName + " and domain " + domainName + " binding due to " + e.getMessage();
+            } catch (final Exception e) {
+                final String errMsg = "Failed to delete virtual server: " + vserverName + " and domain " + domainName + " binding due to " + e.getMessage();
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
                 }
@@ -1619,19 +1537,19 @@ public class NetscalerResource implements ServerResource {
 
         private static void createGslbServiceMonitor(nitro_service nsService, String servicePublicIp, String serviceName) throws ExecutionException {
             try {
-                lbmonitor newmonitor = new lbmonitor();
-                String monitorName = generateGslbServiceMonitorName(servicePublicIp);
+                final lbmonitor newmonitor = new lbmonitor();
+                final String monitorName = generateGslbServiceMonitorName(servicePublicIp);
                 newmonitor.set_type("TCP");
                 newmonitor.set_servicename(serviceName);
                 newmonitor.set_monitorname(monitorName);
                 newmonitor.set_state("ENABLED");
                 lbmonitor.add(nsService, newmonitor);
-            } catch (nitro_exception ne) {
+            } catch (final nitro_exception ne) {
                 if (ne.getErrorCode() == NitroError.NS_RESOURCE_EXISTS) {
                     return;
                 }
-            } catch (Exception e) {
-                String errMsg = "Failed to create GSLB monitor for service public ip" + servicePublicIp;
+            } catch (final Exception e) {
+                final String errMsg = "Failed to create GSLB monitor for service public ip" + servicePublicIp;
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug(errMsg);
                 }
@@ -1641,18 +1559,18 @@ public class NetscalerResource implements ServerResource {
 
         private static void deleteGslbServiceMonitor(nitro_service nsService, String monitorName) throws ExecutionException {
             try {
-                lbmonitor serviceMonitor = lbmonitor.get(nsService, monitorName);
+                final lbmonitor serviceMonitor = lbmonitor.get(nsService, monitorName);
                 if (serviceMonitor != null) {
                     lbmonitor.delete(nsService, serviceMonitor);
                 }
-            } catch (nitro_exception ne) {
+            } catch (final nitro_exception ne) {
                 if (ne.getErrorCode() != NitroError.NS_RESOURCE_NOT_EXISTS) {
-                    String errMsg = "Failed to delete monitor " + monitorName + " for GSLB service due to " + ne.getMessage();
+                    final String errMsg = "Failed to delete monitor " + monitorName + " for GSLB service due to " + ne.getMessage();
                     s_logger.debug(errMsg);
                     throw new com.cloud.utils.exception.ExecutionException(errMsg);
                 }
-            } catch (Exception e) {
-                String errMsg = "Failed to delete monitor " + monitorName + " for GSLB service due to " + e.getMessage();
+            } catch (final Exception e) {
+                final String errMsg = "Failed to delete monitor " + monitorName + " for GSLB service due to " + e.getMessage();
                 s_logger.debug(errMsg);
                 throw new com.cloud.utils.exception.ExecutionException(errMsg);
             }
@@ -1660,11 +1578,11 @@ public class NetscalerResource implements ServerResource {
 
         private static void createGslbServiceGslbMonitorBinding(nitro_service nsService, String monitorName, String serviceName) {
             try {
-                gslbservice_lbmonitor_binding monitorBinding = new gslbservice_lbmonitor_binding();
+                final gslbservice_lbmonitor_binding monitorBinding = new gslbservice_lbmonitor_binding();
                 monitorBinding.set_monitor_name(monitorName);
                 monitorBinding.set_servicename(serviceName);
                 gslbservice_lbmonitor_binding.add(nsService, monitorBinding);
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 // TODO: Nitro API version 10.* is not compatible for NetScalers 9.*, so may fail
                 // against NetScaler version lesser than 10 hence ignore the exception
                 s_logger.warn("Failed to bind monitor to GSLB service due to " + e.getMessage());
@@ -1673,16 +1591,16 @@ public class NetscalerResource implements ServerResource {
 
         private static void deleteGslbServiceGslbMonitorBinding(nitro_service nsService, String monitorName, String serviceName) {
             try {
-                gslbservice_lbmonitor_binding[] monitorBindings = gslbservice_lbmonitor_binding.get(nsService, serviceName);
+                final gslbservice_lbmonitor_binding[] monitorBindings = gslbservice_lbmonitor_binding.get(nsService, serviceName);
                 if (monitorBindings != null && monitorBindings.length > 0) {
-                    for (gslbservice_lbmonitor_binding binding : monitorBindings) {
+                    for (final gslbservice_lbmonitor_binding binding : monitorBindings) {
                         if (binding.get_monitor_name().equalsIgnoreCase(monitorName)) {
                             s_logger.info("Found a binding between monitor " + binding.get_monitor_name() + " and " + binding.get_servicename());
                             gslbservice_lbmonitor_binding.delete(nsService, binding);
                         }
                     }
                 }
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 s_logger.debug("Failed to delete GSLB monitor " + monitorName + " and GSLB service " + serviceName + " binding due to " + e.getMessage() +
                         " but moving on ..., will be cleaned up as part of GSLB " + " service delete any way..");
             }
@@ -1691,11 +1609,11 @@ public class NetscalerResource implements ServerResource {
         // get 'gslbsite' object corresponding to a site name
         private static gslbsite getSiteObject(nitro_service client, String siteName) {
             try {
-                gslbsite site = gslbsite.get(client, siteName);
+                final gslbsite site = gslbsite.get(client, siteName);
                 if (site != null) {
                     return site;
                 }
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 s_logger.info("[ignored]"
                         + "error getting site: " + e.getLocalizedMessage());
             }
@@ -1704,18 +1622,18 @@ public class NetscalerResource implements ServerResource {
 
         private static gslbvserver getVserverObject(nitro_service client, String vserverName) {
             try {
-                gslbvserver vserver = gslbvserver.get(client, vserverName);
+                final gslbvserver vserver = gslbvserver.get(client, vserverName);
                 return vserver;
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 return null;
             }
         }
 
         private static gslbservice getServiceObject(nitro_service client, String serviceName) {
             try {
-                gslbservice service = gslbservice.get(client, serviceName);
+                final gslbservice service = gslbservice.get(client, serviceName);
                 return service;
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 return null;
             }
         }
@@ -1743,13 +1661,13 @@ public class NetscalerResource implements ServerResource {
                 } else {
                     return false;
                 }
-            } catch (nitro_exception e) {
+            } catch (final nitro_exception e) {
                 if (e.getErrorCode() == NitroError.NS_RESOURCE_NOT_EXISTS) {
                     return false;
                 } else {
                     throw new ExecutionException("Failed to verify Server " + serverName + " exists on the NetScaler device due to " + e.getMessage());
                 }
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to verify Server " + serverName + " exists on the NetScaler device due to " + e.getMessage());
             }
         }
@@ -1759,7 +1677,7 @@ public class NetscalerResource implements ServerResource {
         }
 
         private static String genGslbObjectName(Object... args) {
-            StringBuffer buff = new StringBuffer();
+            final StringBuffer buff = new StringBuffer();
             for (int i = 0; i < args.length; i++) {
                 buff.append(args[i]);
                 if (i != args.length - 1) {
@@ -1778,14 +1696,15 @@ public class NetscalerResource implements ServerResource {
 
         private static boolean isSslCertKeyPresent(nitro_service ns, String certKeyName) throws ExecutionException {
 
-            String filter = "certkey:" + certKeyName;
+            final String filter = "certkey:" + certKeyName;
 
             try {
-                if (sslcertkey.count_filtered(ns, filter) > 0)
+                if (sslcertkey.count_filtered(ns, filter) > 0) {
                     return true;
-            } catch (nitro_exception e) {
+                }
+            } catch (final nitro_exception e) {
                 throw new ExecutionException("Failed to get certkey " + e.getMessage());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to get certkey " + e.getMessage());
             }
 
@@ -1795,13 +1714,13 @@ public class NetscalerResource implements ServerResource {
         private static void deleteSslCertKey(nitro_service ns, String certKeyName) throws ExecutionException {
             try {
 
-                sslcertkey certkey = new sslcertkey();
+                final sslcertkey certkey = new sslcertkey();
                 certkey.set_certkey(certKeyName);
                 sslcertkey.delete(ns, certkey);
 
-            } catch (nitro_exception e) {
+            } catch (final nitro_exception e) {
                 throw new ExecutionException("Failed to delete certkey " + e.getMessage());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to delete certkey " + e.getMessage());
             }
 
@@ -1818,12 +1737,13 @@ public class NetscalerResource implements ServerResource {
         private static void createSslCertKey(nitro_service ns, String certFilename, String keyFilename, String certKeyName, String password) throws ExecutionException {
             s_logger.debug("Adding cert to netscaler");
             try {
-                sslcertkey certkey = new sslcertkey();
+                final sslcertkey certkey = new sslcertkey();
                 certkey.set_certkey(certKeyName);
                 certkey.set_cert(SSL_CERT_PATH + certFilename);
 
-                if (keyFilename != null)
+                if (keyFilename != null) {
                     certkey.set_key(SSL_CERT_PATH + keyFilename);
+                }
 
                 if (password != null) {
                     certkey.set_passplain(password);
@@ -1831,44 +1751,25 @@ public class NetscalerResource implements ServerResource {
 
                 certkey.perform_operation(ns);
 
-            } catch (nitro_exception e) {
+            } catch (final nitro_exception e) {
                 throw new ExecutionException("Failed to add certkey binding " + e.getMessage());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to add certkey binding " + e.getMessage());
             }
 
         }
 
-        public static void updateCertKey(nitro_service ns, String certKeyName, String cert, String key, String password) throws ExecutionException {
-            try {
-                sslcertkey certkey = sslcertkey.get(ns, certKeyName);
-                if (cert != null)
-                    certkey.set_cert(cert);
-                if (key != null)
-                    certkey.set_key(cert);
-                if (password != null)
-                    certkey.set_passplain(cert);
-
-                sslcertkey.change(ns, certkey);
-
-            } catch (nitro_exception e) {
-                throw new ExecutionException("Failed to update ssl on load balancer due to " + e.getMessage());
-            } catch (Exception e) {
-                throw new ExecutionException("Failed to update ssl on load balancer due to " + e.getMessage());
-            }
-        }
-
         private static void bindCertKeyToVserver(nitro_service ns, String certKeyName, String vserver) throws ExecutionException {
             s_logger.debug("Adding cert to netscaler");
 
             try {
-                sslvserver_sslcertkey_binding cert_binding = new sslvserver_sslcertkey_binding();
+                final sslvserver_sslcertkey_binding cert_binding = new sslvserver_sslcertkey_binding();
                 cert_binding.set_certkeyname(certKeyName);
                 cert_binding.set_vservername(vserver);
                 cert_binding.perform_operation(ns);
-            } catch (nitro_exception e) {
+            } catch (final nitro_exception e) {
                 throw new ExecutionException("Failed to bind certkey to vserver due to " + e.getMessage());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to bind certkey to vserver due to " + e.getMessage());
             }
         }
@@ -1876,14 +1777,14 @@ public class NetscalerResource implements ServerResource {
         private static void unbindCertKeyFromVserver(nitro_service ns, String certKeyName, String vserver) throws ExecutionException {
             try {
 
-                sslvserver_sslcertkey_binding cert_binding = new sslvserver_sslcertkey_binding();
+                final sslvserver_sslcertkey_binding cert_binding = new sslvserver_sslcertkey_binding();
                 cert_binding.set_certkeyname(certKeyName);
                 cert_binding.set_vservername(vserver);
                 sslvserver_sslcertkey_binding.delete(ns, cert_binding);
 
-            } catch (nitro_exception e) {
+            } catch (final nitro_exception e) {
                 throw new ExecutionException("Failed to unbind certkey to vserver due to " + e.getMessage());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to unbind certkey to vserver due to " + e.getMessage());
             }
 
@@ -1892,7 +1793,7 @@ public class NetscalerResource implements ServerResource {
         private static void uploadCert(String nsIp, String user, String password, String certFilename, byte[] certData) throws ExecutionException {
             try {
                 SshHelper.scpTo(nsIp, SSH_PORT, user, null, password, SSL_CERT_PATH, certData, certFilename, null);
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to copy private key to device " + e.getMessage());
             }
         }
@@ -1900,7 +1801,7 @@ public class NetscalerResource implements ServerResource {
         private static void uploadKey(String nsIp, String user, String password, String keyFilename, byte[] keyData) throws ExecutionException {
             try {
                 SshHelper.scpTo(nsIp, SSH_PORT, user, null, password, SSL_CERT_PATH, keyData, keyFilename, null);
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to copy private key to device " + e.getMessage());
             }
         }
@@ -1910,47 +1811,31 @@ public class NetscalerResource implements ServerResource {
                 return;
             }
             try {
-                base_response result = ns.enable_features(new String[] {"SSL"});
-                if (result.errorcode != 0)
+                final base_response result = ns.enable_features(new String[] {"SSL"});
+                if (result.errorcode != 0) {
                     throw new ExecutionException("Unable to enable SSL on LB");
-            } catch (nitro_exception e) {
+                }
+            } catch (final nitro_exception e) {
                 throw new ExecutionException("Failed to enable ssl feature on load balancer due to " + e.getMessage());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to enable ssl feature on load balancer due to " + e.getMessage());
             }
         }
 
-        public static boolean checkSslFeature(nitro_service ns) throws ExecutionException {
-            try {
-                String[] features = ns.get_enabled_features();
-                if (features != null) {
-                    for (String feature : features) {
-                        if (feature.equalsIgnoreCase("SSL")) {
-                            return true;
-                        }
-                    }
-                }
-                return false;
-            } catch (nitro_exception e) {
-                throw new ExecutionException("Failed to check ssl feature on load balancer due to " + e.getMessage());
-            } catch (Exception e) {
-                throw new ExecutionException("Failed to check ssl feature on load balancer due to " + e.getMessage());
-            }
-        }
-
         public static boolean certLinkExists(nitro_service ns, String userCertName, String caCertName) throws ExecutionException {
             try {
                 // check if there is a link from userCertName to caCertName
 
-                sslcertkey userCert = sslcertkey.get(ns, userCertName);
-                String nsCaCert = userCert.get_linkcertkeyname();
+                final sslcertkey userCert = sslcertkey.get(ns, userCertName);
+                final String nsCaCert = userCert.get_linkcertkeyname();
 
-                if (nsCaCert != null && nsCaCert.equals(caCertName))
+                if (nsCaCert != null && nsCaCert.equals(caCertName)) {
                     return true;
+                }
 
-            } catch (nitro_exception e) {
+            } catch (final nitro_exception e) {
                 throw new ExecutionException("Failed to check cert link on load balancer to " + e.getMessage());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to check cert link on load balancer due to " + e.getMessage());
             }
             return false;
@@ -1961,19 +1846,19 @@ public class NetscalerResource implements ServerResource {
 
                 // the assumption is that that both userCertName and caCertName are present on NS
 
-                sslcertkey caCert = sslcertkey.get(ns, caCertName);
-                sslcertkey userCert = sslcertkey.get(ns, userCertName);
+                final sslcertkey caCert = sslcertkey.get(ns, caCertName);
+                final sslcertkey userCert = sslcertkey.get(ns, userCertName);
 
-                sslcertkey linkResource = new sslcertkey();
+                final sslcertkey linkResource = new sslcertkey();
 
                 // link user cert to CA cert
                 linkResource.set_certkey(userCert.get_certkey());
                 linkResource.set_linkcertkeyname(caCert.get_certkey());
                 sslcertkey.link(ns, linkResource);
 
-            } catch (nitro_exception e) {
+            } catch (final nitro_exception e) {
                 throw new ExecutionException("Failed to check cert link on load balancer to " + e.getMessage());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to check cert link on load balancer due to " + e.getMessage());
             }
 
@@ -1982,14 +1867,14 @@ public class NetscalerResource implements ServerResource {
         public static boolean isCaforCerts(nitro_service ns, String caCertName) throws ExecutionException {
             // check if this certificate  serves as a CA for other certificates
             try {
-                sslcertlink[] childLinks = sslcertlink.get_filtered(ns, "linkcertkeyname:" + caCertName);
+                final sslcertlink[] childLinks = sslcertlink.get_filtered(ns, "linkcertkeyname:" + caCertName);
                 if (childLinks != null && childLinks.length > 0) {
                     return true;
                 }
 
-            } catch (nitro_exception e) {
+            } catch (final nitro_exception e) {
                 throw new ExecutionException("Failed to check cert link on load balancer to " + e.getMessage());
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 throw new ExecutionException("Failed to check cert link on load balancer due to " + e.getMessage());
             }
             return false;
@@ -1999,14 +1884,14 @@ public class NetscalerResource implements ServerResource {
         public static boolean isBoundToVserver(nitro_service ns, String certKeyName, String nsVirtualServerName) throws ExecutionException {
             try {
 
-                sslcertkey_sslvserver_binding[] cert_vs_binding = sslcertkey_sslvserver_binding.get_filtered(ns, certKeyName, "vservername:" + nsVirtualServerName);
+                final sslcertkey_sslvserver_binding[] cert_vs_binding = sslcertkey_sslvserver_binding.get_filtered(ns, certKeyName, "vservername:" + nsVirtualServerName);
                 if (cert_vs_binding != null && cert_vs_binding.length > 0) {
                     return true;
                 }
 
-            } catch (nitro_exception e) {
+            } catch (final nitro_exception e) {
                 throw new Exe

<TRUNCATED>

Mime
View raw message