You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by el...@apache.org on 2018/07/05 19:23:18 UTC

[trafficcontrol] branch master updated: made changes to cleanup the PMD errors and fixed a Unit test bug

This is an automated email from the ASF dual-hosted git repository.

elsloo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new e916ca9  made changes to cleanup the PMD errors and fixed a Unit test bug
e916ca9 is described below

commit e916ca9792ee37713d279fa81a267d5a8cefebec
Author: Dewayne Richardson <de...@apache.org>
AuthorDate: Thu Jul 5 13:20:23 2018 -0600

    made changes to cleanup the PMD errors and fixed a Unit test bug
---
 .../traffic_router/core/config/CertificateChecker.java               | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/config/CertificateChecker.java b/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/config/CertificateChecker.java
index 913177d..3c2c1f7 100644
--- a/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/config/CertificateChecker.java
+++ b/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/config/CertificateChecker.java
@@ -60,6 +60,7 @@ public class CertificateChecker {
 			.isPresent();
 	}
 
+    @SuppressWarnings("PMD.CyclomaticComplexity")
 	private Boolean deliveryServiceHasValidCertificates(final List<CertificateData> certificateDataList, final JsonNode deliveryServicesJson, final String deliveryServiceId) {
 		final JsonNode deliveryServiceJson = deliveryServicesJson.get(deliveryServiceId);
 		final JsonNode protocolJson = deliveryServiceJson.get("protocol");
@@ -86,8 +87,8 @@ public class CertificateChecker {
 			}
 
 			for (final CertificateData certificateData : certificateDataList) {
-				String certificateDeliveryServiceId = certificateData.getDeliveryservice();
-				if (deliveryServiceId == null) {
+				final String certificateDeliveryServiceId = certificateData.getDeliveryservice();
+				if ((deliveryServiceId == null) || deliveryServiceId.equals("")) {
 					LOGGER.error("Delivery Service name is blank for hostname '" +  certificateData.getHostname() + "', skipping.");
 				} else if ((certificateDeliveryServiceId != null) && (deliveryServiceId != null) && (certificateDeliveryServiceId.equals(deliveryServiceId))) {
 					LOGGER.debug("Delivery Service " + deliveryServiceId + " has certificate data for https");