Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datanode migration: fix invalid hostname #19894

Merged
merged 3 commits into from
Jul 17, 2024

Conversation

moesterheld
Copy link
Contributor

@moesterheld moesterheld commented Jul 12, 2024

Description

silently removes trailing slash from hostname

/nocl

Motivation and Context

fixes #19884

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

@moesterheld moesterheld requested a review from todvora July 12, 2024 09:05
if (host.endsWith("/")) {
host = host.substring(0, host.length() - 1);
}
final URI hostname = Objects.requireNonNull(URI.create(host), "hostname has to be provided");
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the order of checks is wrong here. It's too late to require a nonnull host if we use .endsWith before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point. I think getActionArgument will already throw a IllegalArgumentException if the value is missing, but I added a check for a non blank string on top.

@moesterheld moesterheld requested a review from todvora July 15, 2024 04:41
Copy link
Contributor

@todvora todvora left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@todvora todvora merged commit bc34f7e into master Jul 17, 2024
5 checks passed
@todvora todvora deleted the fix/19884-remote-reindex-hostname branch July 17, 2024 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Datanode Migration - Validate input for hostname on Step 4
2 participants