code: private static File matchFile(File dirPath, String regex) {
          if (dirPath != null && dirPath.isDirectory()) {
              List<File> fileList = FileLocator.getMatchingFiles(dirPath, regex);
              for (File currentFile : fileList) {
                  if (currentFile.exists())
                      return currentFile;
              }
          }
          return null;
      }
docs: Internal method: performs test common to matchFileInNamedPath(String, List)
  and {@link #matchFileInFilePath(String, Collection)
  
  @param dirPath
  Directory to check for named file
  @param name
  The name of the file to find
  @return The File object if the file is found;
  null if the dirPath is null, does not exist, or is not a directory.