code: private void ensureParentDirectoryExists(File file) throws ReportException {
          if (!file.getParentFile().exists()) {
              final boolean created = file.getParentFile().mkdirs();
              if (!created) {
                  final String msg = String.format("Unable to create directory '%s'.", file.getParentFile().getAbsolutePath());
                  throw new ReportException(msg);
              }
          }
      }
docs: Validates that the given file's parent directory exists. If the directory
  does not exist an attempt to create the necessary path is made; if that
  fails a ReportException will be raised.
  
  @param file the file or directory directory
  @throws ReportException thrown if the parent directory does not exist and
  cannot be created