@Test public void testIsSubPath() throws IOException { org.apache.hadoop.fs.Path parentPath = new org.apache.hadoop.fs.Path("/tmp/foo/bar"); org.apache.hadoop.fs.Path childPath = new org.apache.hadoop.fs.Path("/tmp/foo/../tar/file.txt"); assertThat(false).isEqualTo(FileUtils.isSubPath(parentPath, childPath)); childPath = new org.apache.hadoop.fs.Path("/tmp/foo/tar/../bar/file.txt"); assertThat(true).isEqualTo(FileUtils.isSubPath(parentPath, childPath)); childPath = new org.apache.hadoop.fs.Path("/tmp/foo/bar/car/file.txt"); assertThat(true).isEqualTo(FileUtils.isSubPath(parentPath, childPath)); }
public static boolean isSubPath(File parent, File child) throws IOException { String childStr = child.getCanonicalPath(); String parentStr = parent.getCanonicalPath(); return childStr.startsWith(parentStr); }
FileUtils { public static boolean isSubPath(File parent, File child) throws IOException { String childStr = child.getCanonicalPath(); String parentStr = parent.getCanonicalPath(); return childStr.startsWith(parentStr); } }
FileUtils { public static boolean isSubPath(File parent, File child) throws IOException { String childStr = child.getCanonicalPath(); String parentStr = parent.getCanonicalPath(); return childStr.startsWith(parentStr); }  }
FileUtils { public static boolean isSubPath(File parent, File child) throws IOException { String childStr = child.getCanonicalPath(); String parentStr = parent.getCanonicalPath(); return childStr.startsWith(parentStr); }  void saveToFile(final String text, final Path destPath); static boolean isSubPath(File parent, File child); static boolean isSubPath(org.apache.hadoop.fs.Path parent, org.apache.hadoop.fs.Path child); }
FileUtils { public static boolean isSubPath(File parent, File child) throws IOException { String childStr = child.getCanonicalPath(); String parentStr = parent.getCanonicalPath(); return childStr.startsWith(parentStr); }  void saveToFile(final String text, final Path destPath); static boolean isSubPath(File parent, File child); static boolean isSubPath(org.apache.hadoop.fs.Path parent, org.apache.hadoop.fs.Path child);  }