Uploaded image for project: 'FOP'
  1. FOP
  2. FOP-2146

Wrong FontCache-Directory used for not existing userHome in FontCache.getDefaultCacheFile() (Bug 47786 was not fixed correctly)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Resolution: Unresolved
    • 1.1
    • None
    • font/unqualified
    • None
    • Operating System: All
      Platform: All
    • 54051

    Description

      Method getDefaultCacheFile() returns an invalid file name if the user has no home directory set. In that case the name of the fop user directory (FOP_USER_DIR!) is returned and not the name of the cache file (DEFAULT_CACHE_FILENAME).

      Wrong Code:

      public static File getDefaultCacheFile(boolean forWriting) {
      File userHome = getUserHome();
      if (userHome != null) {
      File fopUserDir = new File(userHome, FOP_USER_DIR);
      if (forWriting) {
      boolean writable = fopUserDir.canWrite();
      if (!fopUserDir.exists())

      { writable = fopUserDir.mkdir(); }

      if (!writable)

      { userHome = getTempDirectory(); fopUserDir = new File(userHome, FOP_USER_DIR); fopUserDir.mkdir(); }

      }
      return new File(fopUserDir, DEFAULT_CACHE_FILENAME);
      }
      return new File(FOP_USER_DIR);
      }

      If getUserHome() does not return a directory the default name must be returned (and not the name of the directory):

      return new File(DEFAULT_CACHE_FILENAME);

      Attachments

        Activity

          People

            Unassigned Unassigned
            mg@abas.de mg
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated: