cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [3/6] git commit: updated refs/heads/master to 70c79ad
Date Tue, 06 Dec 2016 20:06:20 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/abfcd5b9/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..15fbdeb 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
@@ -16,6 +16,7 @@
 // under the License.
 package com.cloud.network.resource;
 
+import java.io.IOException;
 import java.io.StringWriter;
 import java.security.cert.Certificate;
 import java.util.ArrayList;
@@ -27,9 +28,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 +78,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 +125,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;
@@ -151,13 +151,11 @@ public class NetscalerResource implements ServerResource {
     private String _privateInterface;
     private Integer _numRetries;
     private String _guid;
-    private boolean _inline;
     private boolean _isSdx;
     private boolean _cloudManaged;
     private String _deviceName;
     private String _publicIP;
     private String _publicIPNetmask;
-    private String _publicIPGateway;
     private String _publicIPVlan;
 
     private static final Logger s_logger = Logger.getLogger(NetscalerResource.class);
@@ -177,7 +175,7 @@ public class NetscalerResource implements ServerResource {
     }
 
     @Override
-    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+    public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
         try {
             _name = (String)params.get("name");
             if (_name == null) {
@@ -233,9 +231,7 @@ public class NetscalerResource implements ServerResource {
 
             _isSdx = _deviceName.equalsIgnoreCase("NetscalerSDXLoadBalancer");
 
-            _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"));
             }
 
@@ -251,7 +247,6 @@ public class NetscalerResource implements ServerResource {
             //if the the device is cloud stack provisioned then make it part of the public network
             if (_cloudManaged) {
                 _publicIP = (String)params.get("publicip");
-                _publicIPGateway = (String)params.get("publicipgateway");
                 _publicIPNetmask = (String)params.get("publicipnetmask");
                 _publicIPVlan = (String)params.get("publicipvlan");
                 if ("untagged".equalsIgnoreCase(_publicIPVlan)) {
@@ -264,7 +259,7 @@ public class NetscalerResource implements ServerResource {
             }
 
             return true;
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new ConfigurationException(e.getMessage());
         }
     }
@@ -280,7 +275,7 @@ public class NetscalerResource implements ServerResource {
                     _netscalerSdxService.logout();
                 }
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             // Ignore logout exceptions
         }
     }
@@ -302,15 +297,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 +315,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,56 +325,56 @@ 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());
         }
     }
 
-    private void validateInterfaces(String publicInterface, String privateInterface) throws ExecutionException {
+    private void validateInterfaces(final String publicInterface, final 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());
         }
     }
 
-    private void validateDeviceType(String deviceType) throws ExecutionException {
+    private void validateDeviceType(final 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 +385,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("");
@@ -409,11 +404,11 @@ public class NetscalerResource implements ServerResource {
     }
 
     @Override
-    public Answer executeRequest(Command cmd) {
+    public Answer executeRequest(final Command cmd) {
         return executeRequest(cmd, _numRetries);
     }
 
-    private Answer executeRequest(Command cmd, int numRetries) {
+    private Answer executeRequest(final Command cmd, final int numRetries) {
         if (cmd instanceof ReadyCommand) {
             return execute((ReadyCommand)cmd);
         } else if (cmd instanceof MaintainCommand) {
@@ -439,27 +434,27 @@ public class NetscalerResource implements ServerResource {
         }
     }
 
-    private Answer execute(ReadyCommand cmd) {
+    private Answer execute(final ReadyCommand cmd) {
         return new ReadyAnswer(cmd);
     }
 
-    protected Answer execute(MaintainCommand cmd) {
+    protected Answer execute(final MaintainCommand cmd) {
         return new MaintainAnswer(cmd);
     }
 
-    private synchronized Answer execute(IpAssocCommand cmd, int numRetries) {
+    private synchronized Answer execute(final IpAssocCommand cmd, final int numRetries) {
         if (_isSdx) {
             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 +466,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);
@@ -488,33 +483,33 @@ public class NetscalerResource implements ServerResource {
         return new IpAssocAnswer(cmd, results);
     }
 
-    private Answer execute(HealthCheckLBConfigCommand cmd, int numRetries) {
+    private Answer execute(final HealthCheckLBConfigCommand cmd, final 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 +521,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);
@@ -544,25 +539,25 @@ public class NetscalerResource implements ServerResource {
         return new HealthCheckLBConfigAnswer(hcLB);
     }
 
-    private synchronized Answer execute(LoadBalancerConfigCommand cmd, int numRetries) {
+    private synchronized Answer execute(final LoadBalancerConfigCommand cmd, final int numRetries) {
         try {
             if (_isSdx) {
                 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 +568,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 +584,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 +599,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 +639,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,20 +681,26 @@ 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);
-                                                pemWriter.flush();
+                                                final PemObject pemObject = new PemObject(intermediateCert.getType(), intermediateCert.getEncoded());
+                                                final StringWriter textWriter = new StringWriter();
+                                                try (final PemWriter pemWriter = new PemWriter(textWriter);) {
+                                                    pemWriter.writeObject(pemObject);
+                                                    pemWriter.flush();
+                                                } catch (final IOException e) {
+                                                    if (s_logger.isDebugEnabled())
+                                                    {
+                                                        s_logger.debug("couldn't write PEM to a string", e);
+                                                    } // else just close the certDataStream
+                                                }
 
                                                 SSL.uploadCert(_ip, _username, _password, intermediateCertFileName, textWriter.toString().getBytes());
                                                 SSL.createSslCertKey(_netscalerService, intermediateCertFileName, null, intermediateCertKeyName, null);
@@ -713,18 +714,24 @@ 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();
-                                    certDataStream.write(sslCert.getCert().getBytes());
+                                    try (final ByteArrayOutputStream certDataStream = new ByteArrayOutputStream();) {
+                                        certDataStream.write(sslCert.getCert().getBytes());
 
-                                    if (!SSL.isSslCertKeyPresent(_netscalerService, certKeyName)) {
+                                        if (!SSL.isSslCertKeyPresent(_netscalerService, certKeyName)) {
 
-                                        SSL.uploadCert(_ip, _username, _password, certFilename, certDataStream.toByteArray());
-                                        SSL.uploadKey(_ip, _username, _password, keyFilename, sslCert.getKey().getBytes());
-                                        SSL.createSslCertKey(_netscalerService, certFilename, keyFilename, certKeyName, sslCert.getPassword());
+                                            SSL.uploadCert(_ip, _username, _password, certFilename, certDataStream.toByteArray());
+                                            SSL.uploadKey(_ip, _username, _password, keyFilename, sslCert.getKey().getBytes());
+                                            SSL.createSslCertKey(_netscalerService, certFilename, keyFilename, certKeyName, sslCert.getPassword());
+                                        }
+                                    } catch (final IOException e) {
+                                        if (s_logger.isDebugEnabled())
+                                        {
+                                            s_logger.debug("couldn't open buffer for certificate", e);
+                                        } // else just close the certDataStream
                                     }
 
                                     if (previousCertKeyName != null && !SSL.certLinkExists(_netscalerService, certKeyName, previousCertKeyName)) {
@@ -743,10 +750,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 +772,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 +786,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 +815,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 +834,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 +859,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 +887,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);
@@ -897,18 +904,18 @@ public class NetscalerResource implements ServerResource {
         }
     }
 
-    private synchronized Answer execute(CreateLoadBalancerApplianceCommand cmd, int numRetries) {
+    private synchronized Answer execute(final CreateLoadBalancerApplianceCommand cmd, final int numRetries) {
 
         if (!_isSdx) {
             return Answer.createUnsupportedCommandAnswer(cmd);
         }
 
         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 +933,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 +956,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 +976,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 +1006,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 +1041,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);
             }
@@ -1043,17 +1050,17 @@ public class NetscalerResource implements ServerResource {
         }
     }
 
-    private Answer execute(GlobalLoadBalancerConfigCommand gslbCmd, int numRetries) {
+    private Answer execute(final GlobalLoadBalancerConfigCommand gslbCmd, final 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 +1070,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 +1089,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 +1134,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 +1167,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);
             }
@@ -1182,7 +1189,7 @@ public class NetscalerResource implements ServerResource {
     private static class GSLB {
 
         // create a 'gslbsite' object representing a site
-        private static void createSite(nitro_service client, String siteName, String siteType, String siteIP, String sitePublicIP) throws ExecutionException {
+        private static void createSite(final nitro_service client, final String siteName, final String siteType, final String siteIP, final String sitePublicIP) throws ExecutionException {
             try {
                 gslbsite site;
                 site = getSiteObject(client, siteName);
@@ -1194,7 +1201,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 +1217,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);
                 }
@@ -1220,11 +1227,11 @@ public class NetscalerResource implements ServerResource {
         }
 
         // delete 'gslbsite' object representing a site
-        private static void deleteSite(nitro_service client, String siteName) throws ExecutionException {
+        private static void deleteSite(final nitro_service client, final 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 +1246,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);
                 }
@@ -1249,7 +1256,7 @@ public class NetscalerResource implements ServerResource {
         }
 
         // update 'gslbsite' object representing a site
-        private static void updateSite(nitro_service client, String siteType, String siteName, String siteIP, String sitePublicIP) throws ExecutionException {
+        private static void updateSite(final nitro_service client, final String siteType, final String siteName, final String siteIP, final String sitePublicIP) throws ExecutionException {
             try {
                 gslbsite site;
                 site = getSiteObject(client, siteName);
@@ -1259,7 +1266,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 +1280,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);
                 }
@@ -1284,7 +1291,7 @@ public class NetscalerResource implements ServerResource {
 
         // create a 'gslbvserver' object representing a globally load balanced service
         private static void
-        createVirtualServer(nitro_service client, String vserverName, String lbMethod, String persistenceType, long persistenceId, String serviceType)
+        createVirtualServer(final nitro_service client, final String vserverName, final String lbMethod, final String persistenceType, final long persistenceId, final String serviceType)
                 throws ExecutionException {
             try {
                 gslbvserver vserver;
@@ -1328,8 +1335,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);
                 }
@@ -1338,9 +1345,9 @@ 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 {
+        private static void deleteVirtualServer(final nitro_service client, final 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 +1358,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);
                 }
@@ -1416,20 +1368,20 @@ public class NetscalerResource implements ServerResource {
         }
 
         // create, delete, update, get the GSLB services
-        private static void createService(nitro_service client, String serviceName, String serviceType, String serviceIp, String servicePort, String siteName)
+        private static void createService(final nitro_service client, final String serviceName, final String serviceType, final String serviceIp, final String servicePort, final String siteName)
                 throws ExecutionException {
             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 +1395,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 +1409,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);
                 }
@@ -1466,9 +1418,9 @@ public class NetscalerResource implements ServerResource {
             }
         }
 
-        private static void deleteService(nitro_service client, String serviceName) throws ExecutionException {
+        private static void deleteService(final nitro_service client, final 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 +1431,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);
                 }
@@ -1514,11 +1440,11 @@ public class NetscalerResource implements ServerResource {
             }
         }
 
-        private static void createVserverServiceBinding(nitro_service client, String serviceName, String vserverName, long weight) throws ExecutionException {
+        private static void createVserverServiceBinding(final nitro_service client, final String serviceName, final String vserverName, final 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 +1452,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 +1461,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);
@@ -1544,11 +1470,11 @@ public class NetscalerResource implements ServerResource {
             }
         }
 
-        private static void deleteVserverServiceBinding(nitro_service client, String serviceName, String vserverName) throws ExecutionException {
+        private static void deleteVserverServiceBinding(final nitro_service client, final String serviceName, final 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 +1484,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);
                 }
@@ -1568,10 +1494,10 @@ public class NetscalerResource implements ServerResource {
         }
 
         // create, delete GSLB virtual server and domain bindings
-        private static void createVserverDomainBinding(nitro_service client, String vserverName, String domainName) throws ExecutionException {
+        private static void createVserverDomainBinding(final nitro_service client, final String vserverName, final 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 +1505,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;
@@ -1594,11 +1520,11 @@ public class NetscalerResource implements ServerResource {
             throw new ExecutionException(errMsg);
         }
 
-        private static void deleteVserverDomainBinding(nitro_service client, String vserverName, String domainName) throws ExecutionException {
+        private static void deleteVserverDomainBinding(final nitro_service client, final String vserverName, final 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 +1534,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);
                 }
@@ -1617,21 +1543,21 @@ public class NetscalerResource implements ServerResource {
             }
         }
 
-        private static void createGslbServiceMonitor(nitro_service nsService, String servicePublicIp, String serviceName) throws ExecutionException {
+        private static void createGslbServiceMonitor(final nitro_service nsService, final String servicePublicIp, final 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);
                 }
@@ -1639,127 +1565,127 @@ public class NetscalerResource implements ServerResource {
             }
         }
 
-        private static void deleteGslbServiceMonitor(nitro_service nsService, String monitorName) throws ExecutionException {
+        private static void deleteGslbServiceMonitor(final nitro_service nsService, final 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);
             }
         }
 
-        private static void createGslbServiceGslbMonitorBinding(nitro_service nsService, String monitorName, String serviceName) {
+        private static void createGslbServiceGslbMonitorBinding(final nitro_service nsService, final String monitorName, final 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());
             }
         }
 
-        private static void deleteGslbServiceGslbMonitorBinding(nitro_service nsService, String monitorName, String serviceName) {
+        private static void deleteGslbServiceGslbMonitorBinding(final nitro_service nsService, final String monitorName, final 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..");
             }
         }
 
         // get 'gslbsite' object corresponding to a site name
-        private static gslbsite getSiteObject(nitro_service client, String siteName) {
+        private static gslbsite getSiteObject(final nitro_service client, final 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());
             }
             return null;
         }
 
-        private static gslbvserver getVserverObject(nitro_service client, String vserverName) {
+        private static gslbvserver getVserverObject(final nitro_service client, final 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) {
+        private static gslbservice getServiceObject(final nitro_service client, final 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;
             }
         }
 
-        private static String generateUniqueSiteName(String sitePrivateIp, String sitePublicIP, long dataCenterId) {
+        private static String generateUniqueSiteName(final String sitePrivateIp, final String sitePublicIP, final long dataCenterId) {
             return "cloudsite" + String.valueOf(dataCenterId);
         }
 
-        private static String generateVirtualServerName(String domainName) {
+        private static String generateVirtualServerName(final String domainName) {
             return "cloud-gslb-vserver-" + domainName;
         }
 
-        private static String generateUniqueServiceName(String siteName, String publicIp, String publicPort) {
+        private static String generateUniqueServiceName(final String siteName, final String publicIp, final String publicPort) {
             return "cloud-gslb-service-" + siteName + "-" + publicIp + "-" + publicPort;
         }
 
-        private static String generateGslbServiceMonitorName(String publicIp) {
+        private static String generateGslbServiceMonitorName(final String publicIp) {
             return "cloud-monitor-" + publicIp;
         }
 
-        private static boolean gslbServerExists(nitro_service client, String serverName) throws ExecutionException {
+        private static boolean gslbServerExists(final nitro_service client, final String serverName) throws ExecutionException {
             try {
                 if (com.citrix.netscaler.nitro.resource.config.basic.server.get(client, serverName) != null) {
                     return true;
                 } 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());
             }
         }
 
-        private static String generateGslbServerName(String serverIP) {
+        private static String generateGslbServerName(final String serverIP) {
             return genGslbObjectName("Cloud-Server-", serverIP);
         }
 
-        private static String genGslbObjectName(Object... args) {
-            StringBuffer buff = new StringBuffer();
+        private static String genGslbObjectName(final Object... args) {
+            final StringBuffer buff = new StringBuffer();
             for (int i = 0; i < args.length; i++) {
                 buff.append(args[i]);
                 if (i != args.length - 1) {
@@ -1776,54 +1702,56 @@ public class NetscalerResource implements ServerResource {
         private static final String SSL_CERT_PATH = "/nsconfig/ssl/";
         private static final int SSH_PORT = 22;
 
-        private static boolean isSslCertKeyPresent(nitro_service ns, String certKeyName) throws ExecutionException {
+        private static boolean isSslCertKeyPresent(final nitro_service ns, final 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) 

<TRUNCATED>

Mime
View raw message