ctubbsii commented on a change in pull request #499: Implement new Encryption interface URL: https://github.com/apache/accumulo/pull/499#discussion_r190426025
########## File path: core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/BCFile.java ########## @@ -613,33 +486,13 @@ public void read(DataInput in) throws IOException { fsin, this.region.getOffset(), this.region.getCompressedSize()); InputStream inputStreamToBeCompressed = boundedRangeFileInputStream; - if (cryptoParams != null && cryptoModule != null) { - DataInputStream tempDataInputStream = new DataInputStream(boundedRangeFileInputStream); - // Read the init vector from the front of the stream before initializing the cipher stream - - int ivLength = tempDataInputStream.readInt(); - byte[] initVector = new byte[ivLength]; - tempDataInputStream.readFully(initVector); - - cryptoParams.setInitializationVector(initVector); - cryptoParams.setEncryptedInputStream(boundedRangeFileInputStream); - - // These two flags mirror those in WBlockState, and are very necessary to set in order - // that the underlying stream be written and handled - // correctly. - cryptoParams.setCloseUnderylingStreamAfterCryptoStreamClose(false); - cryptoParams.setRecordParametersToStream(false); - - cryptoParams = cryptoModule.getDecryptingInputStream(cryptoParams); - inputStreamToBeCompressed = cryptoParams.getPlaintextInputStream(); - } - try { + inputStreamToBeCompressed = encryptionStrategy.decryptStream(inputStreamToBeCompressed); this.in = compressAlgo.createDecompressionStream(inputStreamToBeCompressed, decompressor, getFSInputBufferSize(conf)); - } catch (IOException e) { + } catch (Exception e) { compressAlgo.returnDecompressor(decompressor); - throw e; + throw new IOException(e); Review comment: This isn't necessary if the type was already IOException. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services