summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhh <jorge.hernandez-herrero@att.com>2021-01-28 16:30:51 -0600
committerjhh <jorge.hernandez-herrero@att.com>2021-01-28 16:30:51 -0600
commit32905749456bb5309ff9158f9c74043fe0c32a49 (patch)
tree04b08306ab17e06869ef74283b4d7c56f909cc8f
parent77d088a607c33c236bc41c58d9567e10299357a5 (diff)
sonars - protected constructors and typecasting
Issue-ID: POLICY-3017 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I7e7e384db26e244e2514aec3c3579b7b7f92f8a1
-rw-r--r--feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java2
-rw-r--r--feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleState.java4
-rw-r--r--feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleStateUnsupported.java4
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java5
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolset.java4
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/protocol/coders/TopicCoderFilterConfiguration.java6
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/system/internal/FeatureLockImpl.java6
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/system/internal/LockManager.java2
-rw-r--r--policy-utils/src/main/java/org/onap/policy/drools/policies/DomainMaker.java4
-rw-r--r--policy-utils/src/main/java/org/onap/policy/drools/utils/logging/LoggerMarkerFilter.java4
10 files changed, 21 insertions, 20 deletions
diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java
index d56e06e9..ff53a00a 100644
--- a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java
+++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java
@@ -237,7 +237,7 @@ public class LifecycleFsm implements Startable {
List<PolicyTypeDroolsController> opControllers =
policyTypesMap.values().stream()
.filter(typeController -> typeController instanceof PolicyTypeDroolsController)
- .map(typeController -> (PolicyTypeDroolsController) typeController)
+ .map(PolicyTypeDroolsController.class::cast)
.filter(opController -> opController.getControllers().containsKey(controller.getName()))
.collect(Collectors.toList());
diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleState.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleState.java
index ad202e82..035fff3a 100644
--- a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleState.java
+++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleState.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 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.
@@ -40,7 +40,7 @@ public abstract class LifecycleState implements Startable {
/**
* Constructor.
*/
- public LifecycleState(@NonNull LifecycleFsm manager) {
+ protected LifecycleState(@NonNull LifecycleFsm manager) {
this.fsm = manager;
}
diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleStateUnsupported.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleStateUnsupported.java
index f37cf68d..4300c16b 100644
--- a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleStateUnsupported.java
+++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleStateUnsupported.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 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.
@@ -34,7 +34,7 @@ public abstract class LifecycleStateUnsupported extends LifecycleState {
* Constructor.
* @param manager Lifecycle Manager.
*/
- public LifecycleStateUnsupported(LifecycleFsm manager) {
+ protected LifecycleStateUnsupported(LifecycleFsm manager) {
super(manager);
}
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<FactHandle> 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: &lt;class-containing-custom-coder&gt;,&lt;static-coder-field&gt.
*/
- 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<T extends FeatureLockImpl> implements PolicyRe
/**
* Constructs the object.
*/
- public LockManager() {
+ protected LockManager() {
super();
}
diff --git a/policy-utils/src/main/java/org/onap/policy/drools/policies/DomainMaker.java b/policy-utils/src/main/java/org/onap/policy/drools/policies/DomainMaker.java
index ae85d576..37966653 100644
--- a/policy-utils/src/main/java/org/onap/policy/drools/policies/DomainMaker.java
+++ b/policy-utils/src/main/java/org/onap/policy/drools/policies/DomainMaker.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -210,7 +210,7 @@ public class DomainMaker {
*/
public String convertToSchema(@NonNull ToscaPolicyType policyType) {
//
- // TODO:
+ // TODO: // NOSONAR
// 1. Convert Tosca Policy Type definition schema to suitable json schema.
// 2. Call registerValidator to register
throw new UnsupportedOperationException("schema generation from policy type is not supported");
diff --git a/policy-utils/src/main/java/org/onap/policy/drools/utils/logging/LoggerMarkerFilter.java b/policy-utils/src/main/java/org/onap/policy/drools/utils/logging/LoggerMarkerFilter.java
index e15dae0d..b116592c 100644
--- a/policy-utils/src/main/java/org/onap/policy/drools/utils/logging/LoggerMarkerFilter.java
+++ b/policy-utils/src/main/java/org/onap/policy/drools/utils/logging/LoggerMarkerFilter.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018, 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.
@@ -33,7 +33,7 @@ public abstract class LoggerMarkerFilter extends AbstractMatcherFilter<ILoggingE
protected final Marker marker;
- public LoggerMarkerFilter(Marker marker) {
+ protected LoggerMarkerFilter(Marker marker) {
this.marker = marker;
}