diff options
author | Jim Hahn <jrh3@att.com> | 2021-05-06 11:28:53 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2021-05-06 15:26:24 -0400 |
commit | 1d0aaaa5b31719c1718700bb0d1a99c413fd513c (patch) | |
tree | bd2687f1d38f3e3c4e53a68695c8c91c6866468e /utils/src/main/java/org/onap/policy/common/utils/cmd | |
parent | 3b00f1c32b89282dcbb74d3d3645e263f005319e (diff) |
Fix sonars in policy-common
Fixed sonars:
- use "var" instead of actual type name
- re-interrupt threads
- use rej2 split() instead of String split()
Issue-ID: POLICY-3285
Change-Id: I82261e0b8a53ee5c5264556fbf5cec37454f014e
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'utils/src/main/java/org/onap/policy/common/utils/cmd')
-rw-r--r-- | utils/src/main/java/org/onap/policy/common/utils/cmd/CommandLineArgumentsHandler.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/utils/src/main/java/org/onap/policy/common/utils/cmd/CommandLineArgumentsHandler.java b/utils/src/main/java/org/onap/policy/common/utils/cmd/CommandLineArgumentsHandler.java index 37a9047b..b9ba3fdd 100644 --- a/utils/src/main/java/org/onap/policy/common/utils/cmd/CommandLineArgumentsHandler.java +++ b/utils/src/main/java/org/onap/policy/common/utils/cmd/CommandLineArgumentsHandler.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2021 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. @@ -23,7 +24,6 @@ package org.onap.policy.common.utils.cmd; import java.io.PrintWriter; import java.io.StringWriter; import java.net.URISyntaxException; -import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.util.Arrays; @@ -184,9 +184,9 @@ public class CommandLineArgumentsHandler { * @return the help string */ public String help() { - final HelpFormatter helpFormatter = new HelpFormatter(); - final StringWriter stringWriter = new StringWriter(); - final PrintWriter printWriter = new PrintWriter(stringWriter); + final var helpFormatter = new HelpFormatter(); + final var stringWriter = new StringWriter(); + final var printWriter = new PrintWriter(stringWriter); final String cmdLineSyntax = this.helpClassName + " [options...]"; helpFormatter.printHelp(printWriter, HELP_LINE_LENGTH, cmdLineSyntax, "options", options, 0, 0, ""); @@ -243,13 +243,13 @@ public class CommandLineArgumentsHandler { } // The file name refers to a resource on the local file system - final URL fileUrl = ResourceUtils.getUrl4Resource(fileName); + final var fileUrl = ResourceUtils.getUrl4Resource(fileName); if (fileUrl == null) { throw new CommandLineException(fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" does not exist"); } try { - Path path = Path.of(fileUrl.toURI()); + var path = Path.of(fileUrl.toURI()); if (!Files.isRegularFile(path)) { throw new CommandLineException(fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" is not a normal file"); } |