code: public static File getCanonicalFile(final File file) {
          if (file == null) {
              return null;
          }
          try {
              return file.getCanonicalFile();
          } catch (final IOException ex) {
              throw new RuntimeException("Couldn't get canonical file for: " + file, ex);
          }
      }
docs: Returns the canonical file for the file without throwing a checked exception. A potential {@link IOException} is converted into a
  {@link RuntimeException}
  
  @param file
  File to return the canonical file for or <code>null</code>.
  
  @return Canonical file for the given argument or <code>null</code> if the input was <code>null</code>.