public EncryptedSchemaRecordWriter(final File file, final AtomicLong idGenerator, final TocWriter writer, final boolean compressed, final int uncompressedBlockSize, final IdentifierLookup idLookup, ProvenanceEventEncryptor provenanceEventEncryptor, int debugFrequency) throws IOException, EncryptionException { super(file, idGenerator, writer, compressed, uncompressedBlockSize, idLookup); this.provenanceEventEncryptor = provenanceEventEncryptor; this.debugFrequency = debugFrequency; try { this.keyId = getNextAvailableKeyId(); } catch (KeyManagementException e) { logger.error("Encountered an error initializing the encrypted schema record writer because the provided encryptor has no valid keys available: ", e); throw new EncryptionException("No valid keys in the provenance event encryptor", e); } }