HDFS-11098. Datanode in tests cannot start in Windows after HDFS-10638 (Contributed by Vinayakumar B)

This commit is contained in:
Vinayakumar B 2016-11-04 08:31:43 +05:30
parent 5cad93d5c7
commit 69dd5fa2d4

View File

@ -62,8 +62,11 @@ private StorageLocation(StorageType storageType, URI uri) {
// make sure all URIs that point to a file have the same scheme // make sure all URIs that point to a file have the same scheme
try { try {
File uriFile = new File(uri.getPath()); File uriFile = new File(uri.getPath());
String absPath = uriFile.getAbsolutePath(); String uriStr = uriFile.toURI().normalize().toString();
uri = new URI("file", null, absPath, uri.getQuery(), uri.getFragment()); if (uriStr.endsWith("/")) {
uriStr = uriStr.substring(0, uriStr.length() - 1);
}
uri = new URI(uriStr);
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"URI: " + uri + " is not in the expected format"); "URI: " + uri + " is not in the expected format");