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_r314036569
##########
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:
I don't have a problem with wrapping the Exception with an IOException, but
the error message provided should provide more detail about what is happening,
such as `"Unable to read Write-Ahead Log implementation class from " +
snapshotPath` and should include the `UTFDataFormatException` as the cause of
the 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