@Override
  public URI getLatestVersion(URI uri, final @Nullable Pattern pattern)
  {
    final File file = new File(uri);
    try {
      return RetryUtils.retry(
          () -> mostRecentInDir(
              file.isDirectory() ? file.toPath() : file.getParentFile().toPath(),
              pattern
          ),
          shouldRetryPredicate(),
          DEFAULT_RETRY_COUNT
      );
    }
    catch (Exception e) {
      if (e instanceof FileNotFoundException) {
        return null;
      }
      throw new RuntimeException(e);
    }
  }
@ Override public URI getLatestVersion ( URI uri , final @ Nullable Pattern pattern ) { final File file = new File ( uri ) ; try { return RetryUtils . retry ( ( ) -> mostRecentInDir ( file . isDirectory ( ) ? file . toPath ( ) : file . getParentFile ( ) . toPath ( ) , pattern ) , shouldRetryPredicate ( ) , DEFAULT_RETRY_COUNT ) ; } catch ( Exception e ) { if ( e instanceof FileNotFoundException ) { return null ; } throw new RuntimeException ( e ) ; } }
Matches based on a pattern in the file name. Returns the file with the latest timestamp.

@param uri     If it is a file, then the parent is searched. If it is a directory, then the directory is searched.
@param pattern The matching filter to down-select the file names in the directory of interest. Passing `null`
results in matching any file

@return The URI of the most recently modified file which matches the pattern, or `null` if it cannot be found