Skip to content

Conversation

@Attyuttam
Copy link

@Attyuttam Attyuttam commented Nov 26, 2025

Description

This PR...
Fixes: #11821

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@boring-cyborg
Copy link

boring-cyborg bot commented Nov 26, 2025

Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
Here are some useful points:

@codecov
Copy link

codecov bot commented Nov 26, 2025

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.55%. Comparing base (8171d95) to head (6dc89a0).

Files with missing lines Patch % Lines
...-proxy/rdpconsole/src/main/java/common/Client.java 0.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #12135      +/-   ##
============================================
- Coverage     17.56%   17.55%   -0.01%     
+ Complexity    15538    15537       -1     
============================================
  Files          5912     5912              
  Lines        529383   529383              
  Branches      64660    64660              
============================================
- Hits          92984    92956      -28     
- Misses       425941   425968      +27     
- Partials      10458    10459       +1     
Flag Coverage Δ
uitests 3.58% <ø> (ø)
unittests 18.62% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Attyuttam Attyuttam changed the title Fixes: #11821 Change protocol strings to enum values in parsing Protocol options Nov 27, 2025
Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

some alternative (just for consideration)

private Protocol parseOptions(String[] args) {
String protocolName = (args.length > 0) ? args[0] : "";
Protocol protocol = Protocol.NONE;
Protocol protocol;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Protocol protocol;
Protocol protocol;
try {
protocol = Protocol.valueOf(protocolName);
} catch (IllegalArgumentException e) {
protocol = Protocol.NONE;
}

Copy link
Member

Choose a reason for hiding this comment

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

can use this instead

        Protocol protocol = EnumUtils.getEnumIgnoreCase(Protocol.class, protocolName, Protocol.NONE);

btw: no issues with the class, it is not used ...

Comment on lines 305 to 317
if (protocolName.equals(Protocol.VNC.name().toLowerCase())) {
protocol = Protocol.VNC;
options = join(commonOptions, vncOptions);
} else if (protocolName.equals("rdp")) {
} else if (protocolName.equals(Protocol.RDP.name().toLowerCase())) {
protocol = Protocol.RDP;
options = join(commonOptions, rdpOptions);
} else if (protocolName.equals("hyperv")) {
} else if (protocolName.equals(Protocol.HYPERV.name().toLowerCase())) {
protocol = Protocol.HYPERV;
options = join(commonOptions, hyperVOptions);
} else {
help();
return Protocol.NONE;
}
Copy link
Contributor

@DaanHoogland DaanHoogland Nov 27, 2025

Choose a reason for hiding this comment

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

Suggested change
switch (protocol) {
case VNC:
options = join(commonOptions, vncOptions);
break;
case RDP:
options = join(commonOptions, rdpOptions);
break;
case HYPERV:
options = join(commonOptions, hyperVOptions);
break;
case NONE:
help();
return Protocol.NONE;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

remove string definitions and use string to enum constant conversion instead.

3 participants