From 32905749456bb5309ff9158f9c74043fe0c32a49 Mon Sep 17 00:00:00 2001 From: jhh Date: Thu, 28 Jan 2021 16:30:51 -0600 Subject: sonars - protected constructors and typecasting Issue-ID: POLICY-3017 Signed-off-by: jhh Change-Id: I7e7e384db26e244e2514aec3c3579b7b7f92f8a1 --- .../policy/drools/controller/internal/MavenDroolsController.java | 5 +++-- .../onap/policy/drools/protocol/coders/ProtocolCoderToolset.java | 4 ++-- .../drools/protocol/coders/TopicCoderFilterConfiguration.java | 6 +++--- .../org/onap/policy/drools/system/internal/FeatureLockImpl.java | 6 +++--- .../java/org/onap/policy/drools/system/internal/LockManager.java | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) (limited to 'policy-management/src/main/java') diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java index c1eb9f37..46049138 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java +++ b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java @@ -486,7 +486,7 @@ public class MavenDroolsController implements DroolsController { topic)) { logger.warn("{}: DECODING-UNSUPPORTED {}:{}:{}", this, - topic, this.getGroupId(), this.getArtifactId()); + topic, this.getGroupId(), this.getArtifactId()); // NOSONAR return true; } @@ -889,7 +889,8 @@ public class MavenDroolsController implements DroolsController { Collection factHandles = kieSession.getFactHandles(new ClassObjectFilter(objFact.getClass())); for (FactHandle factHandle : factHandles) { if (Objects.equals(objFact, kieSession.getObject(factHandle))) { - logger.info("Slow delete of {} of type {} from {}", objFact, sessionName); + logger.info("Slow delete of {} of type {} from {}", + objFact, objFact.getClass().getName(), sessionName); kieSession.delete(factHandle); return true; } diff --git a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolset.java b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolset.java index 8f99f0dd..7cf3a2f3 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolset.java +++ b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolset.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2018 Samsung Electronics Co., Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -76,7 +76,7 @@ public abstract class ProtocolCoderToolset { * @param controllerId the controller id * @throws IllegalArgumentException if invalid data has been passed in */ - public ProtocolCoderToolset(EventProtocolParams eventProtocolParams, String controllerId) { + protected ProtocolCoderToolset(EventProtocolParams eventProtocolParams, String controllerId) { if (eventProtocolParams == null || controllerId == null) { throw new IllegalArgumentException("Invalid input"); diff --git a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/TopicCoderFilterConfiguration.java b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/TopicCoderFilterConfiguration.java index 2d694530..9da48521 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/TopicCoderFilterConfiguration.java +++ b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/TopicCoderFilterConfiguration.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * policy-management * ================================================================================ - * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2021 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. @@ -41,7 +41,7 @@ public class TopicCoderFilterConfiguration { * * @param rawCustomCoder with format: <class-containing-custom-coder>,<static-coder-field>. */ - public CustomCoder(String rawCustomCoder) { + protected CustomCoder(String rawCustomCoder) { if (rawCustomCoder != null && !rawCustomCoder.isEmpty()) { this.className = rawCustomCoder.substring(0, rawCustomCoder.indexOf(',')); @@ -64,7 +64,7 @@ public class TopicCoderFilterConfiguration { * @param className class name * @param staticCoderField static coder field */ - public CustomCoder(String className, String staticCoderField) { + protected CustomCoder(String className, String staticCoderField) { if (className == null || className.isEmpty()) { throw new IllegalArgumentException("No classname to create CustomCoder cannot be created"); } diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/internal/FeatureLockImpl.java b/policy-management/src/main/java/org/onap/policy/drools/system/internal/FeatureLockImpl.java index 799cca7b..6ec2dc4e 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/internal/FeatureLockImpl.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/internal/FeatureLockImpl.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2021 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. @@ -47,7 +47,7 @@ public abstract class FeatureLockImpl extends LockImpl { /** * Constructs the object. */ - public FeatureLockImpl() { + protected FeatureLockImpl() { this.attached = false; } @@ -62,7 +62,7 @@ public abstract class FeatureLockImpl extends LockImpl { * @param callback callback to be invoked once the lock is granted, or subsequently * lost; must not be {@code null} */ - public FeatureLockImpl(LockState state, String resourceId, String ownerKey, int holdSec, LockCallback callback) { + protected FeatureLockImpl(LockState state, String resourceId, String ownerKey, int holdSec, LockCallback callback) { super(state, resourceId, ownerKey, holdSec, callback); this.attached = true; } diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/internal/LockManager.java b/policy-management/src/main/java/org/onap/policy/drools/system/internal/LockManager.java index ef6b48d2..eee2a50e 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/internal/LockManager.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/internal/LockManager.java @@ -71,7 +71,7 @@ public abstract class LockManager implements PolicyRe /** * Constructs the object. */ - public LockManager() { + protected LockManager() { super(); } -- cgit 1.2.3-korg