From a45f8909871dc1ddb75845f067a602951afc8d11 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 19 Feb 2018 16:56:06 -0500 Subject: Sonar fixes to drools-pdp Fixed most of the instances of the following sonar issues: Moved array designator Used diamond operator Changed System.out/err to use a logger Changed several Thread.sleep() in test code to a single sleep() Useless assignments Replaced comparison with "" to string.isEmpty() Merged if's Replaced ArrayList with List in method returns Reordered type modifiers Reordered constructor methods Defined constants for literals, or replaced them with method calls Removed "throws Xxx" for subclasses of RuntimeException Combined identical "catch" blocks Re-interrupted the current thread after catching an InterruptedException Removed tests against the literal "false" Fix indentation of new makeTopicOperError() method. Fix exception variable name in new methods, logNoUebEncoder() and logNoDmaapEncoder(). Change-Id: Iddae5210553662f733b67333b372dec8c3fe2c94 Issue-ID: POLICY-336 Signed-off-by: Jim Hahn --- .../controller/internal/NullDroolsController.java | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java') diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java index 6dd542c3..245b0b58 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java +++ b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java @@ -1,8 +1,8 @@ -/*- +/* * ============LICENSE_START======================================================= * policy-management * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -106,8 +106,8 @@ public class NullDroolsController implements DroolsController { } @Override - public boolean deliver(TopicSink sink, Object event) throws UnsupportedOperationException { - throw new IllegalStateException(this.getClass().getCanonicalName() + " invoked"); + public boolean deliver(TopicSink sink, Object event) { + throw new IllegalStateException(makeInvokeMsg()); } @Override @@ -127,12 +127,12 @@ public class NullDroolsController implements DroolsController { @Override public boolean ownsCoder(Class coderClass, int modelHash) { - throw new IllegalStateException(this.getClass().getCanonicalName() + " invoked"); + throw new IllegalStateException(makeInvokeMsg()); } @Override public Class fetchModelClass(String className) { - throw new IllegalArgumentException(this.getClass().getCanonicalName() + " invoked"); + throw new IllegalArgumentException(makeInvokeMsg()); } @Override @@ -151,13 +151,12 @@ public class NullDroolsController implements DroolsController { public void updateToVersion(String newGroupId, String newArtifactId, String newVersion, List decoderConfigurations, List encoderConfigurations) - throws IllegalArgumentException, LinkageError { - throw new IllegalArgumentException(this.getClass().getCanonicalName() + " invoked"); + throws LinkageError { + throw new IllegalArgumentException(makeInvokeMsg()); } @Override - public Map factClassNames(String sessionName) - throws IllegalArgumentException { + public Map factClassNames(String sessionName) { return new HashMap<>(); } @@ -177,4 +176,8 @@ public class NullDroolsController implements DroolsController { boolean delete, Object... queryParams) { return new ArrayList<>(); } + + private String makeInvokeMsg() { + return this.getClass().getCanonicalName() + " invoked"; + } } -- cgit 1.2.3-korg