net/src/main/java/com/stanfy/enroscar/net/cache/BaseFileResponseCache.java
private synchronized File ensureWorkingDirectory() throws IOException {
    File directory = getWorkingDirectory();
    if (!directory.exists()) {
      if (!directory.mkdirs()) {
        throw new IOException("Working directory " + directory + " cannot be created");
      }
    } else {
      if (!directory.isDirectory()) {
        if (!directory.delete()) {
          throw new IOException(directory + " is not a directory and cannot be deleted");
        }
        if (!directory.mkdirs()) {
          throw new IOException("Working directory " + directory + " cannot be recreated");
        }
      }
    }
    return directory;
  }
private synchronized File ensureWorkingDirectory() throws IOException {
    File directory = getWorkingDirectory();
    if (!directory.exists()) {
      if (!directory.mkdirs()) {
        throw new IOException("Working directory " + directory + " cannot be created");
      }
    } else {
      if (!directory.isDirectory()) {
        if (!directory.delete()) {
          throw new IOException(directory + " is not a directory and cannot be deleted");
        }
        if (!directory.mkdirs()) {
          throw new IOException("Working directory " + directory + " cannot be recreated");
        }
      }
    }
    return directory;
  }
private synchronized File ensureWorkingDirectory ( ) throws IOException { File directory = getWorkingDirectory ( ) ; if ( ! directory . exists ( ) ) { if ( ! directory . mkdirs ( ) ) { throw new IOException ( "Working directory " + directory + " cannot be created" ) ; } } else { if ( ! directory . isDirectory ( ) ) { if ( ! directory . delete ( ) ) { throw new IOException ( directory + " is not a directory and cannot be deleted" ) ; } if ( ! directory . mkdirs ( ) ) { throw new IOException ( "Working directory " + directory + " cannot be recreated" ) ; } } } return directory ; }
this method is synchronized in order to avoid concurrent calls to mkdir
this method is synchronized in order to avoid concurrent calls to mkdir