@Test public void testNullScheme() throws Exception { assertTrue(PathUtils.impliesURI(new URI("/tmp"), new URI("/tmp/a"))); assertFalse(PathUtils.impliesURI(new URI("file:/tmp"), new URI("/tmp/a"))); assertFalse(PathUtils.impliesURI(new URI("/tmp"), new URI("file:/tmp/a"))); assertFalse(PathUtils.impliesURI(new URI("/tmp"), new URI("/tmpdata"))); }
public static boolean impliesURI(URI privilegeURI, URI requestURI) throws URISyntaxException { if (privilegeURI.getPath() == null || requestURI.getPath() == null) { return false; } if (privilegeURI.getScheme() == null && requestURI.getScheme() != null) { return false; } if (privilegeURI.getScheme() != null && !privilegeURI.getScheme().equals(requestURI.getScheme())) { return false; } String requestPath = ensureEndsWithSeparator(requestURI.getPath()).replace(" String privilegePath = ensureEndsWithSeparator(privilegeURI.getPath()).replace(" if (requestURI.getPath().equals(requestURI.normalize().getPath()) && requestPath.startsWith(privilegePath) && Strings.nullToEmpty(privilegeURI.getAuthority()).equals( Strings.nullToEmpty(requestURI.getAuthority()))) { return true; } return false; }
PathUtils { public static boolean impliesURI(URI privilegeURI, URI requestURI) throws URISyntaxException { if (privilegeURI.getPath() == null || requestURI.getPath() == null) { return false; } if (privilegeURI.getScheme() == null && requestURI.getScheme() != null) { return false; } if (privilegeURI.getScheme() != null && !privilegeURI.getScheme().equals(requestURI.getScheme())) { return false; } String requestPath = ensureEndsWithSeparator(requestURI.getPath()).replace(" String privilegePath = ensureEndsWithSeparator(privilegeURI.getPath()).replace(" if (requestURI.getPath().equals(requestURI.normalize().getPath()) && requestPath.startsWith(privilegePath) && Strings.nullToEmpty(privilegeURI.getAuthority()).equals( Strings.nullToEmpty(requestURI.getAuthority()))) { return true; } return false; } }
PathUtils { public static boolean impliesURI(URI privilegeURI, URI requestURI) throws URISyntaxException { if (privilegeURI.getPath() == null || requestURI.getPath() == null) { return false; } if (privilegeURI.getScheme() == null && requestURI.getScheme() != null) { return false; } if (privilegeURI.getScheme() != null && !privilegeURI.getScheme().equals(requestURI.getScheme())) { return false; } String requestPath = ensureEndsWithSeparator(requestURI.getPath()).replace(" String privilegePath = ensureEndsWithSeparator(privilegeURI.getPath()).replace(" if (requestURI.getPath().equals(requestURI.normalize().getPath()) && requestPath.startsWith(privilegePath) && Strings.nullToEmpty(privilegeURI.getAuthority()).equals( Strings.nullToEmpty(requestURI.getAuthority()))) { return true; } return false; }  }
PathUtils { public static boolean impliesURI(URI privilegeURI, URI requestURI) throws URISyntaxException { if (privilegeURI.getPath() == null || requestURI.getPath() == null) { return false; } if (privilegeURI.getScheme() == null && requestURI.getScheme() != null) { return false; } if (privilegeURI.getScheme() != null && !privilegeURI.getScheme().equals(requestURI.getScheme())) { return false; } String requestPath = ensureEndsWithSeparator(requestURI.getPath()).replace(" String privilegePath = ensureEndsWithSeparator(privilegeURI.getPath()).replace(" if (requestURI.getPath().equals(requestURI.normalize().getPath()) && requestPath.startsWith(privilegePath) && Strings.nullToEmpty(privilegeURI.getAuthority()).equals( Strings.nullToEmpty(requestURI.getAuthority()))) { return true; } return false; }  static boolean impliesURI(URI privilegeURI, URI requestURI); static boolean impliesURI(String privilege, String request); static String parseDFSURI(String warehouseDir, String uri); static String parseURI(String warehouseDir, String uri, boolean isLocal); static String parseLocalURI(String uri); }
PathUtils { public static boolean impliesURI(URI privilegeURI, URI requestURI) throws URISyntaxException { if (privilegeURI.getPath() == null || requestURI.getPath() == null) { return false; } if (privilegeURI.getScheme() == null && requestURI.getScheme() != null) { return false; } if (privilegeURI.getScheme() != null && !privilegeURI.getScheme().equals(requestURI.getScheme())) { return false; } String requestPath = ensureEndsWithSeparator(requestURI.getPath()).replace(" String privilegePath = ensureEndsWithSeparator(privilegeURI.getPath()).replace(" if (requestURI.getPath().equals(requestURI.normalize().getPath()) && requestPath.startsWith(privilegePath) && Strings.nullToEmpty(privilegeURI.getAuthority()).equals( Strings.nullToEmpty(requestURI.getAuthority()))) { return true; } return false; }  static boolean impliesURI(URI privilegeURI, URI requestURI); static boolean impliesURI(String privilege, String request); static String parseDFSURI(String warehouseDir, String uri); static String parseURI(String warehouseDir, String uri, boolean isLocal); static String parseLocalURI(String uri);  }