You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "victoriavargas (JIRA)" <ji...@apache.org> on 2019/01/31 08:12:00 UTC

[jira] [Updated] (FOP-2146) Wrong FontCache-Directory used for not existing userHome in FontCache.getDefaultCacheFile() (Bug 47786 was not fixed correctly)

     [ https://issues.apache.org/jira/browse/FOP-2146?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

victoriavargas updated FOP-2146:
--------------------------------
    Attachment: 62-193-Exam-Dumps-2019.pdf

> Wrong FontCache-Directory used for not existing userHome in FontCache.getDefaultCacheFile() (Bug 47786 was not fixed correctly)
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FOP-2146
>                 URL: https://issues.apache.org/jira/browse/FOP-2146
>             Project: FOP
>          Issue Type: Bug
>          Components: font/unqualified
>    Affects Versions: 1.1
>         Environment: Operating System: All
> Platform: All
>            Reporter: mg
>         Attachments: 62-193-Exam-Dumps-2019.pdf
>
>
> 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);



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)