summaryrefslogtreecommitdiffstats
path: root/services/services-engine/src/main
diff options
context:
space:
mode:
authorarkadiusz.adamski <aadamski@est.tech>2021-03-24 16:24:22 +0000
committerAjith Sreekumar <ajith.sreekumar@bell.ca>2021-03-29 17:36:22 +0000
commitfd5a6566d0e12540b4ac49b24603bae26666ab94 (patch)
tree2c632dc755930aa571b62a9d9a4a6be569836f0f /services/services-engine/src/main
parentc2f7bba321df740d134da7da1a19d7d38b867799 (diff)
Fix sonar issues
- reduce methods Cognitive Complexity from 19 to the 15 allowed in CommandLineParser - iteration replaced with bulk 'Collection.addAll' call - remove redundant initializers - replace try with try-with-resources Issue-ID: POLICY-3093 Signed-off-by: arkadiusz.adamski <aadamski@est.tech> Change-Id: Ia727b3145ef8f63bcfc07723191c85e1ec8c923c
Diffstat (limited to 'services/services-engine/src/main')
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/HeaderDelimitedTextBlockReader.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/HeaderDelimitedTextBlockReader.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/HeaderDelimitedTextBlockReader.java
index 5531d9704..67b7cb871 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/HeaderDelimitedTextBlockReader.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/HeaderDelimitedTextBlockReader.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -50,7 +51,7 @@ public class HeaderDelimitedTextBlockReader implements TextBlockReader, Runnable
// Indicates that text block processing starts at the first block of text
private final boolean delimiterAtStart;
- private boolean blockEndTokenUsed = false;
+ private boolean blockEndTokenUsed;
// The thread used to read the text from the stream
private Thread textConsumputionThread;
@@ -170,9 +171,7 @@ public class HeaderDelimitedTextBlockReader implements TextBlockReader, Runnable
*/
@Override
public void run() {
- final BufferedReader textReader = new BufferedReader(new InputStreamReader(inputStream));
-
- try {
+ try (BufferedReader textReader = new BufferedReader(new InputStreamReader(inputStream))) {
// Read the input line by line until we see end of file on the stream
String line;
while ((line = textReader.readLine()) != null) {