protected void verifyParentDirectory(final File file) throws VisitorException {
    final File dir = file.getParentFile();
    if (!dir.isDirectory()) {
      if (dir.exists()) {
        throw new VisitorException("Path " + dir + " expected to be a directory");
      } else {
        if (!dir.mkdirs()) {
          throw new VisitorException("Could not create directory " + dir);
        }
      }
    }
  }