code: public static String getLocation(File file) {
      Assert.notNull(file, "File cannot be null");
      File parent = file.getParentFile();
      Assert.notNull(parent, new IllegalArgumentException(String.format(
        "Unable to determine the location of file [%1$s]", file)));
      return tryGetCanonicalPathElseGetAbsolutePath(parent);
    }
docs: Returns the absolute path of the given file.
  
  @param file the {@link File} from which to get the absolute filesystem path.
  @return a String indicating the absolute filesystem pathname (location) of the given file.
  @throws java.lang.NullPointerException if the file reference is null.
  @see java.io.File#getParentFile()
  @see #tryGetCanonicalPathElseGetAbsolutePath(java.io.File)