docs: private File createNewUniqueFile(File srcFile, boolean showError) throws IOException {
          String dateString = getDateString();
          int index = findFileIndexAndUpdateCounter(dateString);
  
          String destFileName;
          File destFile;
          do {
              int counter = lastCounter++;
              destFileName = fileName + dateString + '.' + counter + fileExtension;
              destFile = new File(directory, destFileName);
  
              boolean success;
              if (srcFile == null) {
                  success = destFile.createNewFile();
              } else {
                  // We don't want to rename over an existing file, so try to
                  // avoid doing so with a racy exists() check.
                  if (!destFile.exists()) {
                      success = srcFile.renameTo(destFile);
                  } else {
                      success = false;
                  }
              }
  
              if (success) {
                  // Add the file to our list, which will cause old files to be
                  // deleted if we've reached the max.
                  addFile(index, destFileName);
                  return destFile;
              }
          } while (destFile.isFile());
  
          if (srcFile != null && copyFileTo(srcFile, destFile)) {
              addFile(index, destFileName);
              return LoggingFileUtils.deleteFile(srcFile, showError) ? destFile : null;
          }
  
          // Unsafe to use FFDC or ras: log to raw stderr
          if (showError) {
              String msg = Tr.formatMessage(TraceSpecification.getTc(), "UNABLE_TO_CREATE_RESOURCE_NOEX", destFile);
              BaseTraceService.rawSystemErr.println(msg);
          }
          return null;
      }