protected CommitUserData readLatestCommitUserData()

in encryption/src/main/java/org/apache/solr/encryption/EncryptionDirectory.java [211:228]


  protected CommitUserData readLatestCommitUserData() throws IOException {
    try {
      return new SegmentInfos.FindSegmentsFile<CommitUserData>(this) {
        protected CommitUserData doBody(String segmentFileName) throws IOException {
          if (commitUserData != null && commitUserData.segmentFileName.equals(segmentFileName)) {
            // If the segments file is the same, then keep the same commit user data.
            return commitUserData;
          }
          // New segments file, so we have to read it.
          SegmentInfos segmentInfos = SegmentInfos.readCommit(EncryptionDirectory.this, segmentFileName);
          return new CommitUserData(segmentFileName, segmentInfos.getUserData());
        }
      }.run();
    } catch (NoSuchFileException | FileNotFoundException e) {
      // No commit yet, so no encryption key.
      return CommitUserData.EMPTY;
    }
  }