public static String tryGetCanonicalPathElseGetAbsolutePath(final File file){
  try {
    return file.getCanonicalPath();
  }
 catch (  IOException e) {
    return file.getAbsolutePath();
  }
}

public static String tryGetCanonicalPathElseGetAbsolutePath ( final File file ) { try { return file . getCanonicalPath ( ) ; } catch ( IOException e ) { return file . getAbsolutePath ( ) ; } }
this method attempts to get the canonical path of the specified file otherwise returns it ' s absolute path . < p / >
