code: public static File tryGetCanonicalFileElseGetAbsoluteFile(File file) {
      try {
        return file.getCanonicalFile();
      }
      catch (IOException ignore) {
        return file.getAbsoluteFile();
      }
    }
docs: Attempts to the get the canonical form of the given file, otherwise returns the absolute form of the file.
  
  @param file the {@link File} from which the canonical or absolute file will be returned.
  @return the canonical form of the file unless an IOException occurs then return the absolute form of the file.
  @throws NullPointerException if the file reference is null.
  @see java.io.File#getAbsoluteFile()
  @see java.io.File#getCanonicalFile()