Skip to content

Commit

Permalink
HADOOP-18612. Avoid mixing canonical and non-canonical when performin…
Browse files Browse the repository at this point in the history
…g comparisons
  • Loading branch information
Steve Vaughan Jr committed Feb 2, 2023
1 parent ad0cff2 commit fa1cf3b
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1321,16 +1321,16 @@ public void testCreateJarWithClassPath() throws Exception {
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
Expand Down Expand Up @@ -1385,7 +1385,7 @@ public void testGetJarsInDirectory() throws Exception {
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()));
}
}

Expand Down

0 comments on commit fa1cf3b

Please sign in to comment.