[
https://issues.apache.org/jira/browse/HDFS-5125?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13747348#comment-13747348
]
Binglin Chang commented on HDFS-5125:
-------------------------------------
Hi [~cnauroth],
{code}
private static final Pattern hasDriveLetterSpecifier =
Pattern.compile("^/?[a-zA-Z]:");
private static boolean hasWindowsDrive(String path) {
return (WINDOWS && hasDriveLetterSpecifier.matcher(path).find());
}
public boolean isUriPathAbsolute() {
int start = hasWindowsDrive(uri.getPath()) ? 3 : 0;
return uri.getPath().startsWith(SEPARATOR, start);
}
{code}
I suspect Path.isUriPathAbsolute may be flawed:
1. "file:/C:" should be a absolute directory, right? but without ending "/",
uri.getPath().startsWith(SEPARATOR, start) will yield false
2. Another issue is probably not relevant to this bug, but still a problem:
hasDriveLetterSpecifier allow first "/" to be skiped, but the code "int
start = hasWindowsDrive(uri.getPath()) ? 3 : 0;" always assume first "/"
exists.
Anyway, I can provide a patch first to try to solve this according my thoughts,
but I don't have a windows environment to test this.
> TestCreateEditsLog#testCanLoadCreatedEditsLog fails on Windows in globStatus
> ----------------------------------------------------------------------------
>
> Key: HDFS-5125
> URL: https://issues.apache.org/jira/browse/HDFS-5125
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: test
> Affects Versions: 3.0.0, 2.1.1-beta
> Reporter: Chris Nauroth
>
> This test calls the {{CreateEditsLog}} tool, then runs {{globStatus}} on the
> local file system to find the resulting files before moving them to a
> directory where a NameNode can start up and read them. The HADOOP-9877 patch
> has caused this test to start failing on Windows due to internal calls to
> {{FileContext#getFileLinkStatus}} rejecting the {{Path}} arguments.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira