natural 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_r323583075
 
 

 ##########
 File path: 
nifi-commons/nifi-write-ahead-log/src/main/java/org/wali/MinimalLockingWriteAheadLog.java
 ##########
 @@ -360,8 +369,13 @@ private Long recoverFromSnapshot(final Map<Object, T> 
recordMap) throws IOExcept
 
         // at this point, we know the snapshotPath exists because if it 
didn't, then we either returned null
         // or we renamed partialPath to snapshotPath. So just Recover from 
snapshotPath.
-        try (final DataInputStream dataIn = new DataInputStream(new 
BufferedInputStream(Files.newInputStream(snapshotPath, 
StandardOpenOption.READ)))) {
-            final String waliImplementationClass = dataIn.readUTF();
+        try (final DataInputStream dataIn = new DataInputStream(new 
BufferedInputStream(SimpleCipherInputStream.wrapWithKey(Files.newInputStream(snapshotPath,
 StandardOpenOption.READ), cipherKey)))) {
+            String waliImplementationClass;
+            try {
+                waliImplementationClass = dataIn.readUTF();
+            } catch (final java.io.UTFDataFormatException e) {
+                throw new IOException("malformed input");
 
 Review comment:
   This is really a great catch, thank you for seeing this.  I've updated the 
message and included `snapshotPath` and the original exception.

----------------------------------------------------------------
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

Reply via email to