You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Mark Fulton (JIRA)" <ji...@apache.org> on 2016/05/19 16:06:12 UTC

[jira] [Created] (JCS-163) false error message when reusing a cache directory

Mark Fulton created JCS-163:
-------------------------------

             Summary: false error message when reusing a cache directory
                 Key: JCS-163
                 URL: https://issues.apache.org/jira/browse/JCS-163
             Project: Commons JCS
          Issue Type: Bug
          Components: Indexed Disk Cache, JDBC Disk Cache
    Affects Versions: jcs-2.0-beta-1
            Reporter: Mark Fulton


JCS logs an {{ERROR}} if the disk cache directory already existed:

{noformat}
63   [main] ERROR org.apache.commons.jcs.auxiliary.disk.AbstractDiskCacheAttributes  - Failed to create directory C:\MyCache
{noformat}

This is because [{{AbstractDiskCacheAttributes.setDiskPath(File)}}|http://commons.apache.org/proper/commons-jcs/commons-jcs-core/apidocs/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheAttributes.html#setDiskPath(java.io.File)] [uses|http://commons.apache.org/proper/commons-jcs/commons-jcs-core/xref/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheAttributes.html#L80] the result of [{{File.mkdirs()}}|http://docs.oracle.com/javase/6/docs/api/java/io/File.html#mkdirs()] as if it returns {{true}} if the directories exist after invocation but this is not the case, it only returns "{{true}} if and only if the directory was created, along with all necessary parent directories; {{false}} otherwise."

[{{File.exists()}}|http://docs.oracle.com/javase/6/docs/api/java/io/File.html#exists()] (or similar) should be used instead to trigger logging an {{ERROR}} or not.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)