/** * Returns the canonical form of the given file or the normalized absolute form if resolving the * prior fails. * * @return The canonical or absolute path of this file as a <code>java.io.File</code> instance. * @throws NullPointerException If <code>file</code> is <code>null</code>. */ public static java.io.File getCanOrAbsFile(java.io.File file) { try { return file.getCanonicalFile(); } catch (IOException ex) { final java.io.File parent = file.getParentFile(); return normalize( parent != null ? new java.io.File(getCanOrAbsFile(parent), file.getName()) : file.getAbsoluteFile()); } }