MAPREDUCE-5366. TestMRAsyncDiskService fails on Windows. Contributed by Chuan Liu.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1500842 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris Nauroth 2013-07-08 17:07:38 +00:00
parent 6770de7ec4
commit 4175e41548
2 changed files with 8 additions and 5 deletions

View File

@ -615,6 +615,9 @@ Release 2.1.0-beta - 2013-07-02
MAPREDUCE-5360. TestMRJobClient fails on Windows due to path format.
(Chuan Liu via cnauroth)
MAPREDUCE-5366. TestMRAsyncDiskService fails on Windows. (Chuan Liu via
cnauroth)
MAPREDUCE-5291. Change MR App to use updated property names in
container-log4j.properties. (Zhijie Shen via sseth)

View File

@ -59,8 +59,8 @@ private String relativeToWorking(String pathname) {
pathname = (new Path(pathname)).toUri().getPath();
cwd = (new Path(cwd)).toUri().getPath();
String [] cwdParts = cwd.split(File.separator);
String [] pathParts = pathname.split(File.separator);
String [] cwdParts = cwd.split(Path.SEPARATOR);
String [] pathParts = pathname.split(Path.SEPARATOR);
// There are three possible cases:
// 1) pathname and cwd are equal. Return '.'
@ -94,18 +94,18 @@ private String relativeToWorking(String pathname) {
int parentDirsRequired = cwdParts.length - common;
for (int i = 0; i < parentDirsRequired; i++) {
sb.append("..");
sb.append(File.separator);
sb.append(Path.SEPARATOR);
}
// Then append all non-common parts of 'pathname' itself.
for (int i = common; i < pathParts.length; i++) {
sb.append(pathParts[i]);
sb.append(File.separator);
sb.append(Path.SEPARATOR);
}
// Don't end with a '/'.
String s = sb.toString();
if (s.endsWith(File.separator)) {
if (s.endsWith(Path.SEPARATOR)) {
s = s.substring(0, s.length() - 1);
}