code: private String getMergedPath(String hostName, Path p, String objectName) {
      if ((p.getParent() != null) && (p.getName() != null)
          && (p.getParent().toString().equals(hostName))) {
        if (objectName.equals(p.getName())) {
          return p.toString();
        }
        if (objectName.startsWith(p.getName())) {
          return p.getParent() + objectName;
        }
        return p.toString();
      }
      return hostName + objectName;
    }
docs: Merge between two paths
  
  @param hostName
  @param p path
  @param objectName
  @return merged path