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 --- .../java/org/onap/policy/drools/eelf/EelfFeature.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'feature-eelf/src') diff --git a/feature-eelf/src/main/java/org/onap/policy/drools/eelf/EelfFeature.java b/feature-eelf/src/main/java/org/onap/policy/drools/eelf/EelfFeature.java index e48bd2fa..aac456e2 100644 --- a/feature-eelf/src/main/java/org/onap/policy/drools/eelf/EelfFeature.java +++ b/feature-eelf/src/main/java/org/onap/policy/drools/eelf/EelfFeature.java @@ -1,8 +1,8 @@ -/*- +/* * ============LICENSE_START======================================================= * feature-eelf * ================================================================================ - * 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. @@ -36,7 +36,7 @@ import org.onap.policy.drools.system.PolicyEngine; public class EelfFeature implements PolicyEngineFeatureAPI { @Override - final public boolean beforeBoot(PolicyEngine engine, String cliArgs[]) { + public final boolean beforeBoot(PolicyEngine engine, String[] cliArgs) { String logback = System.getProperty(Main.LOGBACK_CONFIGURATION_FILE_SYSTEM_PROPERTY, Main.LOGBACK_CONFIGURATION_FILE_DEFAULT); @@ -53,17 +53,18 @@ public class EelfFeature implements PolicyEngineFeatureAPI { Logger logger = FlexLogger.getLogger(this.getClass(), true); if (logger.isInfoEnabled()) { - logger.info("eelf-feature: Property " + Main.LOGBACK_CONFIGURATION_FILE_SYSTEM_PROPERTY + "=" + - System.getProperty(Main.LOGBACK_CONFIGURATION_FILE_SYSTEM_PROPERTY)); - logger.info("eelf-feature: Property " + Configuration.PROPERTY_LOGGING_FILE_PATH + "=" + - System.getProperty(Configuration.PROPERTY_LOGGING_FILE_PATH)); - logger.info("eelf-feature: Property " + Configuration.PROPERTY_LOGGING_FILE_NAME + "=" + - System.getProperty(Configuration.PROPERTY_LOGGING_FILE_NAME)); + logProperty(logger, Main.LOGBACK_CONFIGURATION_FILE_SYSTEM_PROPERTY); + logProperty(logger, Configuration.PROPERTY_LOGGING_FILE_PATH); + logProperty(logger, Configuration.PROPERTY_LOGGING_FILE_NAME); } return false; } + private void logProperty(Logger logger, String propnm) { + logger.info("eelf-feature: Property " + propnm + "=" + System.getProperty(propnm)); + } + @Override public int getSequenceNumber() { return 0; -- cgit 1.2.3-korg