code: @Nullable
    public static File getSecureFile (@Nullable final File aFile)
    {
      if (aFile == null)
        return null;
  
      String sRet = null;
      // Go through all directories and secure them
      File aWork = new File (FilenameHelper.getCleanPath (aFile));
      while (aWork != null)
      {
        String sSecuredName;
        if (aWork.getParent () == null)
        {
          // For the root directory
          sSecuredName = aWork.getPath ();
        }
        else
        {
          // Secure path element name
          sSecuredName = FilenameHelper.getAsSecureValidFilename (aWork.getName ());
        }
        sRet = sRet == null ? sSecuredName : sSecuredName + "/" + sRet;
        aWork = aWork.getParentFile ();
      }
      return new File (sRet);
    }
docs: Get a secure {@link File} object based on the passed file object. First all
  relative paths ("." and "..") are resolved and all eventually contained
  '\0' characters are eliminated. Than all file names are checked for
  validity (so that no special characters are contained).
  
  @param aFile
  The file to be secured.
  @return <code>null</code> if the passed file is <code>null</code>.