protected int checkDirectoryWriteable(String location) {
        final String methodName = "checkDirectoryWriteable()";
        int rc = CacheOnDisk.LOCATION_OK;
        if (location.equals("")) {
            rc = CacheOnDisk.LOCATION_NOT_DEFINED;
        } else if (location.startsWith("${") && location.indexOf("}") > 0) {
            rc = CacheOnDisk.LOCATION_NOT_VALID;
        } else {
            try {
                File f = new File(location);
                if (!f.exists()) {
                    if (!f.mkdirs()) {
                        rc = CacheOnDisk.LOCATION_CANNOT_MAKE_DIR;
                    }
                } else if (!f.isDirectory()) {
                    rc = CacheOnDisk.LOCATION_NOT_DIRECTORY;
                } else if (!f.canWrite()) {
                    rc = CacheOnDisk.LOCATION_NOT_WRITABLE;
                }
            } catch (Throwable t) {
                rc = CacheOnDisk.LOCATION_NOT_WRITABLE;
                com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.cache.CacheOnDisk.checkDirectoryWriteable", "1779", this);
                traceDebug(methodName, "cacheName=" + this.cacheName + " location=" + location + "\nException: " + ExceptionUtility.getStackTrace(t));
            }
        }

        traceDebug(methodName, "cacheName=" + this.cacheName + " location=" + location + " rc=" + rc);
        return rc;
    }
protected int checkDirectoryWriteable ( String location ) { final String methodName = "checkDirectoryWriteable()" ; int rc = CacheOnDisk . LOCATION_OK ; if ( location . equals ( "" ) ) { rc = CacheOnDisk . LOCATION_NOT_DEFINED ; } else if ( location . startsWith ( "${" ) && location . indexOf ( "}" ) > 0 ) { rc = CacheOnDisk . LOCATION_NOT_VALID ; } else { try { File f = new File ( location ) ; if ( ! f . exists ( ) ) { if ( ! f . mkdirs ( ) ) { rc = CacheOnDisk . LOCATION_CANNOT_MAKE_DIR ; } } else if ( ! f . isDirectory ( ) ) { rc = CacheOnDisk . LOCATION_NOT_DIRECTORY ; } else if ( ! f . canWrite ( ) ) { rc = CacheOnDisk . LOCATION_NOT_WRITABLE ; } } catch ( Throwable t ) { rc = CacheOnDisk . LOCATION_NOT_WRITABLE ; com . ibm . ws . ffdc . FFDCFilter . processException ( t , "com.ibm.ws.cache.CacheOnDisk.checkDirectoryWriteable" , "1779" , this ) ; traceDebug ( methodName , "cacheName=" + this . cacheName + " location=" + location + "\nException: " + ExceptionUtility . getStackTrace ( t ) ) ; } } traceDebug ( methodName , "cacheName=" + this . cacheName + " location=" + location + " rc=" + rc ) ; return rc ; }
Check the location whether it is writable or not

@param location
@return int 0 = OK 1 = LOCATION_NOT_DEFINED 2 = INVALID_LOCATION 3 = LOCATION_NOT_DIRECTORY 4 =
LOCATION_NOT_WRITABLE 5 = LOCATION_CANNOT_MAKE_DIR