PathUtils { public static String parseLocalURI(String uri) throws URISyntaxException { Path uriPath = new Path(uri); if (uriPath.isAbsolute()) { uriPath = new Path(LOCAL_FILE_SCHEMA + AUTHORITY_PREFIX + StringUtils.trimToEmpty(uriPath.toUri().getAuthority()) + Path.getPathWithoutSchemeAndAuthority(uriPath)); } else { throw new IllegalArgumentException("Parse URI does not work on relative URI: " + uri); } return uriPath.toUri().toString(); }  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);  }
@Test public void testParseLocalURI() throws Exception { assertEquals("file: parseLocalURI("/tmp/hive-user")); assertEquals("file: parseLocalURI("file:/tmp/hive-user")); assertEquals("file: parseLocalURI("file: assertEquals("file: PathUtils.parseLocalURI("file: }