public IndexRevision(IndexWriter writer) throws IOException {IndexDeletionPolicy delPolicy = writer.getConfig().getIndexDeletionPolicy();if (!(delPolicy instanceof SnapshotDeletionPolicy)) {throw new IllegalArgumentException("IndexWriter must be created with SnapshotDeletionPolicy");}this.writer = writer;this.sdp = (SnapshotDeletionPolicy) delPolicy;this.commit = sdp.snapshot();this.version = revisionVersion(commit);this.sourceFiles = revisionFiles(commit);}

public IndexRevision(IndexWriter writer){sdp = writer.Config.IndexDeletionPolicy as SnapshotDeletionPolicy;if (sdp == null)throw new ArgumentException("IndexWriter must be created with SnapshotDeletionPolicy", "writer");this.writer = writer;this.commit = sdp.Snapshot();this.version = RevisionVersion(commit);this.sourceFiles = RevisionFiles(commit);}
