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

HDFS-17249. Fix TestDFSUtil.testIsValidName() unit test failure #6249

Merged
merged 3 commits into from
Nov 13, 2023
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,12 @@ public static boolean isValidName(String src) {
String[] components = StringUtils.split(src, '/');
for (int i = 0; i < components.length; i++) {
String element = components[i];
// For Windows, we must allow the : in the drive letter.
if (Shell.WINDOWS && i == 1 && element.contains(":")) {
Copy link
Member

Choose a reason for hiding this comment

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

Could you please make an endsWith check for : instead of element.contains?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, Thanks

continue;
}
if (element.equals(".") ||
// For Windows, we must allow the : in the drive letter.
(!Shell.WINDOWS && i == 1 && element.contains(":")) ||
(element.contains(":")) ||
(element.contains("/"))) {
return false;
}
Expand Down