From 611f63a4bb71d677cf2665b1794e91148ba42a51 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Wed, 17 Jun 2020 08:37:15 -0400 Subject: Cleanup various sonar issues in policy-common Addressed the following issues: - unused imports - unused method parameters - use assertEquals, assertSame instead of assertTrue - provide the parametrized type for this generic Also fixed some checkstyle issues: - removed blank lines between "import" groups Issue-ID: POLICY-2650 Change-Id: I004bb650ac10c49ccd0fc405f6959896fec39f9b Signed-off-by: Jim Hahn --- .../policy/common/utils/resources/ResourceUtils.java | 1 - .../common/utils/services/OrderedServiceImpl.java | 17 ++++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'utils/src/main/java') diff --git a/utils/src/main/java/org/onap/policy/common/utils/resources/ResourceUtils.java b/utils/src/main/java/org/onap/policy/common/utils/resources/ResourceUtils.java index 58e2baf5..2acc67ac 100644 --- a/utils/src/main/java/org/onap/policy/common/utils/resources/ResourceUtils.java +++ b/utils/src/main/java/org/onap/policy/common/utils/resources/ResourceUtils.java @@ -33,7 +33,6 @@ import java.util.Set; import java.util.TreeSet; import java.util.jar.JarEntry; import java.util.jar.JarFile; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/utils/src/main/java/org/onap/policy/common/utils/services/OrderedServiceImpl.java b/utils/src/main/java/org/onap/policy/common/utils/services/OrderedServiceImpl.java index bbd30220..7c5c9cbb 100644 --- a/utils/src/main/java/org/onap/policy/common/utils/services/OrderedServiceImpl.java +++ b/utils/src/main/java/org/onap/policy/common/utils/services/OrderedServiceImpl.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * utils * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,18 +24,18 @@ import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Map; import java.util.ServiceLoader; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * This class is a template for building a sorted list of service instances, - * which are discovered and created using 'ServiceLoader'. + * which are discovered and created using 'ServiceLoader'. */ public class OrderedServiceImpl { // logger - private static Logger logger = LoggerFactory.getLogger(OrderedServiceImpl.class); + private static Logger logger = LoggerFactory.getLogger(OrderedServiceImpl.class); // sorted list of instances implementing the service private List implementers = null; @@ -44,8 +44,7 @@ public class OrderedServiceImpl { private ServiceLoader serviceLoader = null; // use this to ensure that we only use one unique instance of each class - @SuppressWarnings("rawtypes") - private static HashMap classToSingleton = new HashMap<>(); + private static Map,OrderedService> classToSingleton = new HashMap<>(); /** * Constructor - create the 'ServiceLoader' instance. @@ -60,7 +59,7 @@ public class OrderedServiceImpl { /** * Get List of implementers. - * + * * @return the sorted list of services implementing interface 'T' discovered * by 'ServiceLoader'. */ -- cgit 1.2.3-korg