aboutsummaryrefslogtreecommitdiffstats
path: root/tools/simple-wsclient
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/simple-wsclient
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/simple-wsclient')
-rw-r--r--tools/simple-wsclient/src/main/java/org/onap/policy/apex/tools/simple/wsclient/SimpleConsole.java4
-rw-r--r--tools/simple-wsclient/src/main/java/org/onap/policy/apex/tools/simple/wsclient/WsClientMain.java21
2 files changed, 13 insertions, 12 deletions
diff --git a/tools/simple-wsclient/src/main/java/org/onap/policy/apex/tools/simple/wsclient/SimpleConsole.java b/tools/simple-wsclient/src/main/java/org/onap/policy/apex/tools/simple/wsclient/SimpleConsole.java
index ca123c9bb..8e607ebd4 100644
--- a/tools/simple-wsclient/src/main/java/org/onap/policy/apex/tools/simple/wsclient/SimpleConsole.java
+++ b/tools/simple-wsclient/src/main/java/org/onap/policy/apex/tools/simple/wsclient/SimpleConsole.java
@@ -133,8 +133,8 @@ public class SimpleConsole extends WebSocketClient {
thread.setName("ClientThread");
thread.start();
- final BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
- StringBuilder event = new StringBuilder();
+ final var in = new BufferedReader(new InputStreamReader(System.in));
+ var event = new StringBuilder();
String line;
while ((line = in.readLine()) != null) {
if ("exit".equals(line)) {
diff --git a/tools/simple-wsclient/src/main/java/org/onap/policy/apex/tools/simple/wsclient/WsClientMain.java b/tools/simple-wsclient/src/main/java/org/onap/policy/apex/tools/simple/wsclient/WsClientMain.java
index 9b0674df9..e3af4dcc1 100644
--- a/tools/simple-wsclient/src/main/java/org/onap/policy/apex/tools/simple/wsclient/WsClientMain.java
+++ b/tools/simple-wsclient/src/main/java/org/onap/policy/apex/tools/simple/wsclient/WsClientMain.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * 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.
@@ -50,14 +51,14 @@ public final class WsClientMain {
/**
* Run the command.
- *
+ *
* @param args the command line arguments
* @param outStream stream for output
*/
WsClientMain(final String[] args, final PrintStream outStream) {
- boolean console = false;
+ var console = false;
- final CliParser cli = new CliParser();
+ final var cli = new CliParser();
cli.addOption(CliOptions.HELP);
cli.addOption(CliOptions.VERSION);
cli.addOption(CliOptions.CONSOLE);
@@ -89,7 +90,7 @@ public final class WsClientMain {
/**
* Run the console or echo.
- *
+ *
* @param console if true, run the console otherwise run echo
* @param cmd the command line to run
* @param outStream stream for output
@@ -140,7 +141,7 @@ public final class WsClientMain {
outStream.println();
try {
- final SimpleEcho simpleEcho = new SimpleEcho(server, port, APP_NAME, outStream, outStream);
+ final var simpleEcho = new SimpleEcho(server, port, APP_NAME, outStream, outStream);
simpleEcho.connect();
} catch (final URISyntaxException uex) {
String message = APP_NAME + ": URI exception, could not create URI from server and port settings";
@@ -180,7 +181,7 @@ public final class WsClientMain {
outStream.println();
try {
- final SimpleConsole simpleConsole = new SimpleConsole(server, port, APP_NAME, outStream, outStream);
+ final var simpleConsole = new SimpleConsole(server, port, APP_NAME, outStream, outStream);
simpleConsole.runClient();
} catch (final URISyntaxException uex) {
String message = APP_NAME + ": URI exception, could not create URI from server and port settings";
@@ -207,15 +208,15 @@ public final class WsClientMain {
/**
* Get the help string for the application.
- *
+ *
* @param cli the command line options
* @return the help string
*/
private String getHelpString(final CliParser cli) {
- HelpFormatter formatter = new HelpFormatter();
+ var formatter = new HelpFormatter();
- final StringWriter helpStringWriter = new StringWriter();
- final PrintWriter helpPrintWriter = new PrintWriter(helpStringWriter);
+ final var helpStringWriter = new StringWriter();
+ final var helpPrintWriter = new PrintWriter(helpStringWriter);
formatter.printHelp(helpPrintWriter, 120, APP_NAME, APP_DESCRIPTION, cli.getOptions(), 2, 4, "");