use of org.apache.hadoop.hdfs.protocol.UnresolvedPathException in project hadoop by apache.
the class NameNodeRpcServer method getLinkTarget.
// ClientProtocol
@Override
public String getLinkTarget(String path) throws IOException {
checkNNStartup();
metrics.incrGetLinkTargetOps();
HdfsFileStatus stat = null;
try {
stat = namesystem.getFileInfo(path, false);
} catch (UnresolvedPathException e) {
return e.getResolvedPath().toString();
} catch (UnresolvedLinkException e) {
// The NameNode should only throw an UnresolvedPathException
throw new AssertionError("UnresolvedLinkException thrown");
}
if (stat == null) {
throw new FileNotFoundException("File does not exist: " + path);
} else if (!stat.isSymlink()) {
throw new IOException("Path " + path + " is not a symbolic link");
}
return stat.getSymlink();
}
Aggregations