List of usage examples for org.apache.hadoop.hdfs.protocol UnresolvedPathException getResolvedPath
public Path getResolvedPath()
From source file:common.NameNode.java
License:Apache License
/** @inheritDoc */ public String getLinkTarget(String path) throws IOException { myMetrics.numgetLinkTargetOps.inc(); /* Resolves the first symlink in the given path, returning a * new path consisting of the target of the symlink and any * remaining path components from the original path. *///ww w . java 2s .co m try { HdfsFileStatus stat = namesystem.getFileInfo(path, false); if (stat != null) { // NB: getSymlink throws IOException if !stat.isSymlink() return stat.getSymlink(); } } catch (UnresolvedPathException e) { return e.getResolvedPath().toString(); } catch (UnresolvedLinkException e) { // The NameNode should only throw an UnresolvedPathException throw new AssertionError("UnresolvedLinkException thrown"); } return null; }