HADOOP-18612. Avoid mixing canonical and non-canonical when performing comparisons (#5339)
Contributed by Steve Vaughan Jr
This commit is contained in:
parent
10b42e9306
commit
221221d6fb
|
@ -1292,16 +1292,16 @@ public class TestFileUtil {
|
|||
if (wildcardPath.equals(classPath)) {
|
||||
// add wildcard matches
|
||||
for (File wildcardMatch: wildcardMatches) {
|
||||
expectedClassPaths.add(wildcardMatch.toURI().toURL()
|
||||
expectedClassPaths.add(wildcardMatch.getCanonicalFile().toURI().toURL()
|
||||
.toExternalForm());
|
||||
}
|
||||
} else {
|
||||
File fileCp = null;
|
||||
if(!new Path(classPath).isAbsolute()) {
|
||||
fileCp = new File(tmp, classPath);
|
||||
fileCp = new File(tmp, classPath).getCanonicalFile();
|
||||
}
|
||||
else {
|
||||
fileCp = new File(classPath);
|
||||
fileCp = new File(classPath).getCanonicalFile();
|
||||
}
|
||||
if (nonExistentSubdir.equals(classPath)) {
|
||||
// expect to maintain trailing path separator if present in input, even
|
||||
|
@ -1356,7 +1356,8 @@ public class TestFileUtil {
|
|||
for (Path jar: jars) {
|
||||
URL url = jar.toUri().toURL();
|
||||
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