Source:
<code>protected MantaMultipartUploadPart uploadPart(final EncryptedMultipartUpload<WRAPPED_UPLOAD> upload, final int partNumber, final HttpEntity sourceEntity) throws IOException { Validate.notNull(upload, "Multipart upload object must not be null"); if (!upload.canUpload()) { String msg = "Multipart object is not in a state that it can be " + "used for uploading parts. For encrypted multipart " + "uploads, only multipart upload objects returned from " + "the initiateUpload() method can be used to upload parts."; throw new IllegalArgumentException(msg); } final EncryptionState encryptionState = upload.getEncryptionState(); encryptionState.getLock().lock(); <START> final EncryptionContext encryptionContext = encryptionState.getEncryptionContext(); <END> try { validatePartNumber(partNumber); if (encryptionState.getLastPartNumber() != -1) { Validate.isTrue(encryptionState.getLastPartNumber() + 1 == partNumber, "Encrypted MPU parts must be serial and sequential"); } else { encryptionState.setMultipartStream(new MultipartOutputStream( encryptionContext.getCipherDetails().getBlockSizeInBytes())); encryptionState.setCipherStream(EncryptingEntityHelper.makeCipherOutputForStream( encryptionState.getMultipartStream(), encryptionContext)); } final EncryptingPartEntity entity = new EncryptingPartEntity( encryptionState.getCipherStream(), encryptionState.getMultipartStream(), sourceEntity); encryptionState.setLastPartNumber(partNumber); return wrapped.uploadPart(upload.getWrapped(), partNumber, entity); } finally { encryptionState.getLock().unlock(); } }</code><technical_language>I this fail, a matter of hygiene log try</technical_language>

Target:
protected MantaMultipartUploadPart uploadPart(final EncryptedMultipartUpload<WRAPPED_UPLOAD> upload, final int partNumber, final HttpEntity sourceEntity) throws IOException { Validate.notNull(upload, "Multipart upload object must not be null"); if (!upload.canUpload()) { String msg = "Multipart object is not in a state that it can be " + "used for uploading parts. For encrypted multipart " + "uploads, only multipart upload objects returned from " + "the initiateUpload() method can be used to upload parts."; throw new IllegalArgumentException(msg); } final EncryptionState encryptionState = upload.getEncryptionState(); final EncryptionContext encryptionContext = encryptionState.getEncryptionContext(); encryptionState.getLock().lock(); try { validatePartNumber(partNumber); if (encryptionState.getLastPartNumber() != -1) { Validate.isTrue(encryptionState.getLastPartNumber() + 1 == partNumber, "Encrypted MPU parts must be serial and sequential"); } else { encryptionState.setMultipartStream(new MultipartOutputStream( encryptionContext.getCipherDetails().getBlockSizeInBytes())); encryptionState.setCipherStream(EncryptingEntityHelper.makeCipherOutputForStream( encryptionState.getMultipartStream(), encryptionContext)); } final EncryptingPartEntity entity = new EncryptingPartEntity( encryptionState.getCipherStream(), encryptionState.getMultipartStream(), sourceEntity); encryptionState.setLastPartNumber(partNumber); return wrapped.uploadPart(upload.getWrapped(), partNumber, entity); } finally { encryptionState.getLock().unlock(); } }