diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileUtil.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileUtil.java index c884e223365c9..94d90b2eb978a 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileUtil.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileUtil.java @@ -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 @@ -1385,7 +1385,8 @@ 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())); } }