Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 21 additions & 13 deletions services/console-proxy/rdpconsole/src/main/java/common/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ enum Protocol {
NONE, VNC, RDP, HYPERV
}

private static final String VNC = "vnc";
private static final String RDP = "rdp";
private static final String HYPERV = "hyperv";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think, no need of this string definitions, try with string to enum constant conversion?


// Common options
private final Option help = new Option() {
{
Expand Down Expand Up @@ -299,21 +303,25 @@ private Element setMainElementAndAddressBasedOnProtocol(Protocol protocol, SSLSt

private Protocol parseOptions(String[] args) {
String protocolName = (args.length > 0) ? args[0] : "";
Protocol protocol = Protocol.NONE;
Protocol protocol;
Comment thread
DaanHoogland marked this conversation as resolved.
Comment thread
sureshanaparti marked this conversation as resolved.

Option[] options;
if (protocolName.equals("vnc")) {
protocol = Protocol.VNC;
options = join(commonOptions, vncOptions);
} else if (protocolName.equals("rdp")) {
protocol = Protocol.RDP;
options = join(commonOptions, rdpOptions);
} else if (protocolName.equals("hyperv")) {
protocol = Protocol.HYPERV;
options = join(commonOptions, hyperVOptions);
} else {
help();
return Protocol.NONE;
switch (protocolName) {
case VNC:
protocol = Protocol.VNC;
options = join(commonOptions, vncOptions);
break;
case RDP:
protocol = Protocol.RDP;
options = join(commonOptions, rdpOptions);
break;
case HYPERV:
protocol = Protocol.HYPERV;
options = join(commonOptions, hyperVOptions);
break;
default:
help();
return Protocol.NONE;
}
Comment thread
sureshanaparti marked this conversation as resolved.
Outdated

// Parse all options for given protocol
Expand Down
Loading