public static String addUserHomeDirectoryIfApplicable(String origPathStr, String user)
    throws IOException, URISyntaxException {
    if(origPathStr == null || origPathStr.isEmpty()) {
      return "/user/" + user;
    }
    Path p = new Path(origPathStr);
    if(p.isAbsolute()) {
      return origPathStr;
    }
    if(p.toUri().getPath().isEmpty()) {
      //origPathStr="hdfs://host:99" for example
      return new Path(p.toUri().getScheme(), p.toUri().getAuthority(), "/user/" + user).toString();
    }
    //can't have relative path if there is scheme/authority
    return "/user/" + user + "/" + origPathStr;
  }
@return true iff we are sure the file is not there.
hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/TempletonUtils.java