summaryrefslogtreecommitdiffstats
path: root/tools/tools-common/src/main
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-08-27 14:49:41 -0400
committerJim Hahn <jrh3@att.com>2021-08-27 15:48:46 -0400
commit9d8894092ced589c0bdc5b9e85ee1bf1c85d3e36 (patch)
tree88ff5f3891e8780cf8386bb46283dec82c0b3897 /tools/tools-common/src/main
parent18c8028c79d1bdd7bca80fe1e22e2cd9bc072695 (diff)
Address more sonars in apex-pdp
Fixed services-engine thru utilities. Fixed: - use "var" - use Files.delete() - only one method call in assert() Issue-ID: POLICY-3093 Change-Id: I6f62108c770c15e8b84bc51746066fefa409e0fc Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'tools/tools-common/src/main')
-rw-r--r--tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java5
-rw-r--r--tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/OutputFile.java7
2 files changed, 6 insertions, 6 deletions
diff --git a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java
index 1b80af3f2..59c3c0e73 100644
--- a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java
+++ b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 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.
@@ -188,7 +189,7 @@ public final class Console {
return;
}
- final StringBuilder err = new StringBuilder();
+ final var err = new StringBuilder();
if (appName != null) {
err.append(this.getAppName()).append(": ");
}
@@ -217,7 +218,7 @@ public final class Console {
return;
}
- final StringBuilder warn = new StringBuilder();
+ final var warn = new StringBuilder();
if (appName != null) {
warn.append(this.getAppName()).append(": ");
}
diff --git a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/OutputFile.java b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/OutputFile.java
index 2a20554b5..4b04b4037 100644
--- a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/OutputFile.java
+++ b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/OutputFile.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (c) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 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.
@@ -29,7 +30,6 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;
import java.nio.file.FileSystems;
-import java.nio.file.Path;
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -76,8 +76,7 @@ public class OutputFile {
* @return a File object for this output file
*/
public File toFile() {
- final Path fp = FileSystems.getDefault().getPath(fileName);
- return fp.toFile();
+ return FileSystems.getDefault().getPath(fileName).toFile();
}
/**
@@ -115,7 +114,7 @@ public class OutputFile {
* @return null on success, an error message on error
*/
public String validate() {
- final File file = toFile();
+ final var file = toFile();
if (file.exists()) {
if (!overwrite) {
return "file already exists";