HADOOP-18612. Avoid mixing canonical and non-canonical when performing comparisons (#5339)
Contributed by Steve Vaughan Jr
This commit is contained in:
parent
aed6fcee5b
commit
5f5157ac53
|
@ -1321,16 +1321,16 @@ public class TestFileUtil {
|
||||||
if (wildcardPath.equals(classPath)) {
|
if (wildcardPath.equals(classPath)) {
|
||||||
// add wildcard matches
|
// add wildcard matches
|
||||||
for (File wildcardMatch: wildcardMatches) {
|
for (File wildcardMatch: wildcardMatches) {
|
||||||
expectedClassPaths.add(wildcardMatch.toURI().toURL()
|
expectedClassPaths.add(wildcardMatch.getCanonicalFile().toURI().toURL()
|
||||||
.toExternalForm());
|
.toExternalForm());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
File fileCp = null;
|
File fileCp = null;
|
||||||
if(!new Path(classPath).isAbsolute()) {
|
if(!new Path(classPath).isAbsolute()) {
|
||||||
fileCp = new File(tmp, classPath);
|
fileCp = new File(tmp, classPath).getCanonicalFile();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fileCp = new File(classPath);
|
fileCp = new File(classPath).getCanonicalFile();
|
||||||
}
|
}
|
||||||
if (nonExistentSubdir.equals(classPath)) {
|
if (nonExistentSubdir.equals(classPath)) {
|
||||||
// expect to maintain trailing path separator if present in input, even
|
// expect to maintain trailing path separator if present in input, even
|
||||||
|
@ -1385,7 +1385,8 @@ public class TestFileUtil {
|
||||||
for (Path jar: jars) {
|
for (Path jar: jars) {
|
||||||
URL url = jar.toUri().toURL();
|
URL url = jar.toUri().toURL();
|
||||||
assertTrue("the jar should match either of the jars",
|
assertTrue("the jar should match either of the jars",
|
||||||
url.equals(jar1.toURI().toURL()) || url.equals(jar2.toURI().toURL()));
|
url.equals(jar1.getCanonicalFile().toURI().toURL()) ||
|
||||||
|
url.equals(jar2.getCanonicalFile().toURI().toURL()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue