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 --- .../src/main/java/org/onap/policy/common/ia/DbDao.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java') diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java index 80177b30..28e8e387 100644 --- a/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java +++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Integrity Audit * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-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. @@ -48,7 +48,7 @@ import org.onap.policy.common.logging.flexlogger.Logger; * */ public class DbDao { - private static final Logger logger = FlexLogger.getLogger(DbDao.class.getName()); + private static final Logger logger = FlexLogger.getLogger(); private String resourceName; private String persistenceUnit; @@ -505,17 +505,16 @@ public class DbDao { // if IntegrityAuditEntity entry exists for resourceName and PU, update it. If not // found, create a new entry - Query iaequery = em.createQuery(SELECT_STRING); + TypedQuery iaequery = em.createQuery(SELECT_STRING, IntegrityAuditEntity.class); iaequery.setParameter("rn", resourceName); iaequery.setParameter("pu", persistenceUnit); - @SuppressWarnings("rawtypes") - List iaeList = iaequery.getResultList(); + List iaeList = iaequery.getResultList(); IntegrityAuditEntity iae; if (!iaeList.isEmpty()) { // ignores multiple results - iae = (IntegrityAuditEntity) iaeList.get(0); + iae = iaeList.get(0); } else { // If it does not exist -- cgit 1.2.3-korg