PathsUpdate implements Updateable.Update { public static List<String> parsePath(String path) { try { LOGGER.debug("Parsing path " + path); URI uri = null; if (StringUtils.isNotEmpty(path)) { uri = new URI(URIUtil.encodePath(path)); } else { return null; } String scheme = uri.getScheme(); if (scheme == null) { URI defaultUri = FileSystem.getDefaultUri(CONF); scheme = defaultUri.getScheme(); } Preconditions.checkNotNull(scheme); if(scheme.equalsIgnoreCase("hdfs")) { return Lists.newArrayList(uri.getPath().split("^/")[1] .split("/")); } else { LOGGER.warn("Invalid FS: " + scheme + ": return null; } } catch (URISyntaxException e) { throw new RuntimeException("Incomprehensible path [" + path + "]"); } catch (URIException e){ throw new RuntimeException("Unable to create URI: ",e); } } PathsUpdate();  PathsUpdate(TPathsUpdate tPathsUpdate);  PathsUpdate(long seqNum, boolean hasFullImage); @Override boolean hasFullImage(); TPathChanges newPathChange(String authzObject); List<TPathChanges> getPathChanges(); @Override long getSeqNum(); @Override void setSeqNum(long seqNum); TPathsUpdate toThrift(); @VisibleForTesting static Configuration getConfiguration(); static List<String> parsePath(String path); @Override byte[] serialize(); @Override void deserialize(byte[] data); static String ALL_PATHS; }
@Test public void testParsePath(){ List<String> results = PathsUpdate.parsePath( "hdfs: ); System.out.println(results); Assert.assertNotNull("Parse path without throwing exception",results); }