From 6b6eb52ef3111142ba2dc9afb85cdd48dc0454ca Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 10 May 2021 11:39:27 -0400 Subject: Fix sonars in policy models Fixed: - use "var" Issue-ID: POLICY-3094 Change-Id: Id5ea7ab049c2018744afa75a55d44e47f216d5bc Signed-off-by: Jim Hahn --- .../onap/policy/models/provider/impl/AbstractModelsProvider.java | 6 +++--- .../models/provider/impl/DatabasePolicyModelsProviderImpl.java | 6 +++--- .../policy/models/provider/impl/DummyPolicyModelsProviderImpl.java | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'models-provider/src/main') diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractModelsProvider.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractModelsProvider.java index a0c5ce678..dc0a1f62e 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractModelsProvider.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractModelsProvider.java @@ -69,17 +69,17 @@ public abstract class AbstractModelsProvider implements Closeable { parameters.getPersistenceUnit()); if (pfDao != null) { - String errorMessage = "provider is already initialized"; + var errorMessage = "provider is already initialized"; throw new PfModelException(Response.Status.NOT_ACCEPTABLE, errorMessage); } // Parameters for the DAO - final DaoParameters daoParameters = new DaoParameters(); + final var daoParameters = new DaoParameters(); daoParameters.setPluginClass(DefaultPfDao.class.getName()); daoParameters.setPersistenceUnit(parameters.getPersistenceUnit()); // @formatter:off - Properties jdbcProperties = new Properties(); + var jdbcProperties = new Properties(); jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_DRIVER, parameters.getDatabaseDriver()); jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_URL, parameters.getDatabaseUrl()); jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_USER, parameters.getDatabaseUser()); diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java index 1839604aa..a90dc895c 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java @@ -146,7 +146,7 @@ public class DatabasePolicyModelsProviderImpl extends AbstractModelsProvider imp throws PfModelException { assertInitialized(); - ToscaConceptIdentifier policyTypeIdentifier = new ToscaConceptIdentifier(name, version); + var policyTypeIdentifier = new ToscaConceptIdentifier(name, version); assertPolicyTypeNotSupportedInPdpGroup(policyTypeIdentifier); return new AuthorativeToscaProvider().deletePolicyType(getPfDao(), name, version); @@ -197,7 +197,7 @@ public class DatabasePolicyModelsProviderImpl extends AbstractModelsProvider imp throws PfModelException { assertInitialized(); - ToscaConceptIdentifier policyIdentifier = new ToscaConceptIdentifier(name, version); + var policyIdentifier = new ToscaConceptIdentifier(name, version); assertPolicyNotDeployedInPdpGroup(policyIdentifier); return new AuthorativeToscaProvider().deletePolicy(getPfDao(), name, version); @@ -314,7 +314,7 @@ public class DatabasePolicyModelsProviderImpl extends AbstractModelsProvider imp */ private void assertInitialized() { if (getPfDao() == null) { - String errorMessage = "policy models provider is not initilaized"; + var errorMessage = "policy models provider is not initilaized"; throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, errorMessage); } } diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java index 07617aad9..f47f4d464 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java @@ -274,7 +274,7 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider { * @return the ToscaServiceTemplate with the dummy response */ protected ToscaServiceTemplate getDummyResponse(final String fileName) { - StandardCoder standardCoder = new StandardCoder(); + var standardCoder = new StandardCoder(); ToscaServiceTemplate serviceTemplate; try { -- cgit 1.2.3-korg