diff options
author | a.sreekumar <ajith.sreekumar@est.tech> | 2020-02-07 16:27:26 +0000 |
---|---|---|
committer | a.sreekumar <ajith.sreekumar@est.tech> | 2020-02-10 16:57:38 +0000 |
commit | 93a3e76cef9e3c39ce90b6c68f3d551ee489149b (patch) | |
tree | 524391e903a3b4a860d472de43560049c56e2e2b /main/src/main | |
parent | ce9d064bf511926f0f187d5b28ff018a492556cf (diff) |
Cleanup the sonar issues in PAP
Change-Id: I0eccc6064eb0b49d84370104d1219074ec8bde71
Issue-ID: POLICY-2271
Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
Diffstat (limited to 'main/src/main')
4 files changed, 9 insertions, 25 deletions
diff --git a/main/src/main/java/org/onap/policy/pap/main/parameters/PapParameterHandler.java b/main/src/main/java/org/onap/policy/pap/main/parameters/PapParameterHandler.java index 0bcbb5cb..e730da2e 100644 --- a/main/src/main/java/org/onap/policy/pap/main/parameters/PapParameterHandler.java +++ b/main/src/main/java/org/onap/policy/pap/main/parameters/PapParameterHandler.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-2020 Nordix Foundation. * Modifications Copyright (C) 2019 AT&T Intellectual Property. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -59,8 +59,7 @@ public class PapParameterHandler { papParameterGroup = CODER.decode(file, PapParameterGroup.class); } catch (final CoderException e) { final String errorMessage = "error reading parameters from \"" + arguments.getConfigurationFilePath() - + "\"\n" + "(" + e.getClass().getSimpleName() + "):" + e.getMessage(); - LOGGER.error(errorMessage, e); + + "\"\n" + "(" + e.getClass().getSimpleName() + ")"; throw new PolicyPapException(errorMessage, e); } diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupCreateOrUpdateProvider.java b/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupCreateOrUpdateProvider.java index ee6cbe4c..4e61621b 100644 --- a/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupCreateOrUpdateProvider.java +++ b/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupCreateOrUpdateProvider.java @@ -272,7 +272,7 @@ public class PdpGroupCreateOrUpdateProvider extends ProviderBase { dbgroup.getPdpSubgroups().add(subgrp); } else { - updated = updateSubGroup(data, dbsub, subgrp, subResult) || updated; + updated = updateSubGroup(dbsub, subgrp, subResult) || updated; } result.addResult(subResult); @@ -371,20 +371,17 @@ public class PdpGroupCreateOrUpdateProvider extends ProviderBase { /** * Updates an existing subgroup. * - * @param data session data * @param dbsub the subgroup, from the DB * @param subgrp the subgroup to be updated, updated to fully qualified versions upon * return * @param container container for additional validation results * @return {@code true} if the subgroup content was changed, {@code false} if there * were no changes - * @throws PfModelException if an error occurred */ - private boolean updateSubGroup(SessionData data, PdpSubGroup dbsub, PdpSubGroup subgrp, - BeanValidationResult container) throws PfModelException { + private boolean updateSubGroup(PdpSubGroup dbsub, PdpSubGroup subgrp, BeanValidationResult container) { // perform additional validations first - if (!validateSubGroup(data, dbsub, subgrp, container)) { + if (!validateSubGroup(dbsub, subgrp, container)) { return false; } @@ -405,16 +402,13 @@ public class PdpGroupCreateOrUpdateProvider extends ProviderBase { /** * Performs additional validations of a subgroup. * - * @param data session data * @param dbsub the subgroup, from the DB * @param subgrp the subgroup to be validated, updated to fully qualified versions * upon return * @param container container for additional validation results * @return {@code true} if the subgroup is valid, {@code false} otherwise - * @throws PfModelException if an error occurred */ - private boolean validateSubGroup(SessionData data, PdpSubGroup dbsub, PdpSubGroup subgrp, - BeanValidationResult container) throws PfModelException { + private boolean validateSubGroup(PdpSubGroup dbsub, PdpSubGroup subgrp, BeanValidationResult container) { BeanValidationResult result = new BeanValidationResult(subgrp.getPdpType(), subgrp); diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupStateChangeControllerV1.java b/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupStateChangeControllerV1.java index e739b2fc..3aa3d93f 100644 --- a/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupStateChangeControllerV1.java +++ b/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupStateChangeControllerV1.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-2020 Nordix Foundation. * Modifications Copyright (C) 2019 AT&T Intellectual Property. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,9 +29,7 @@ import io.swagger.annotations.Authorization; import io.swagger.annotations.Extension; import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.ResponseHeader; - import java.util.UUID; - import javax.ws.rs.HeaderParam; import javax.ws.rs.PUT; import javax.ws.rs.Path; @@ -39,7 +37,6 @@ import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; - import org.apache.commons.lang3.tuple.Pair; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.pap.concepts.PdpGroupStateChangeResponse; @@ -54,7 +51,7 @@ import org.slf4j.LoggerFactory; */ public class PdpGroupStateChangeControllerV1 extends PapRestControllerV1 { - private static final Logger LOGGER = LoggerFactory.getLogger(PdpGroupQueryControllerV1.class); + private static final Logger LOGGER = LoggerFactory.getLogger(PdpGroupStateChangeControllerV1.class); private final PdpGroupStateChangeProvider provider = new PdpGroupStateChangeProvider(); diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/ProviderBase.java b/main/src/main/java/org/onap/policy/pap/main/rest/ProviderBase.java index 5665e795..d567b6d3 100644 --- a/main/src/main/java/org/onap/policy/pap/main/rest/ProviderBase.java +++ b/main/src/main/java/org/onap/policy/pap/main/rest/ProviderBase.java @@ -3,6 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,8 +39,6 @@ import org.onap.policy.pap.main.PapConstants; import org.onap.policy.pap.main.PolicyModelsProviderFactoryWrapper; import org.onap.policy.pap.main.comm.PdpModifyRequestMap; import org.onap.policy.pap.main.notification.PolicyNotifier; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Super class of providers that deploy and undeploy PDP groups. The following items must @@ -51,11 +50,8 @@ import org.slf4j.LoggerFactory; * </ul> */ public abstract class ProviderBase { - private static final String DEPLOY_FAILED = "failed to deploy/undeploy policies"; public static final String DB_ERROR_MSG = "DB error"; - private static final Logger logger = LoggerFactory.getLogger(ProviderBase.class); - /** * Lock used when updating PDPs. */ @@ -108,11 +104,9 @@ public abstract class ProviderBase { data.updateDb(); } catch (PfModelException | PfModelRuntimeException e) { - logger.warn(DEPLOY_FAILED, e); throw e; } catch (RuntimeException e) { - logger.warn(DEPLOY_FAILED, e); throw new PfModelException(Status.INTERNAL_SERVER_ERROR, "request failed", e); } |