markap14 commented on a change in pull request #3594: NIFI-3833 Support for
Encrypted Flow File Repositories
URL: https://github.com/apache/nifi/pull/3594#discussion_r314028968
##########
File path:
nifi-commons/nifi-write-ahead-log/src/main/java/org/apache/nifi/wali/LengthDelimitedJournal.java
##########
@@ -411,9 +417,10 @@ public JournalRecovery recoverRecords(final Map<Object,
T> recordMap, final Set<
final double journalLength = journalFile.length();
try (final InputStream fis = new FileInputStream(journalFile);
- final InputStream bufferedIn = new BufferedInputStream(fis);
- final ByteCountingInputStream byteCountingIn = new
ByteCountingInputStream(bufferedIn);
- final DataInputStream in = new DataInputStream(byteCountingIn)) {
+ final InputStream bufferedIn = new BufferedInputStream(fis);
+ final InputStream plainIn =
SimpleCipherInputStream.wrapWithKey(bufferedIn, cipherKey);
+ final ByteCountingInputStream byteCountingIn = new
ByteCountingInputStream(plainIn);
Review comment:
`byteCountingIn` is used to know how much data has been consumed for logging
purposes. It probably makes sense to wrap `bufferedIn` with `byteCountingIn` so
that any log message that indicates "X number of bytes have been read" tells us
how many bytes were actually consumed from the file. As-is here, this tells us
how many post-decryption bytes were consumed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services