|
48 | 48 | import org.slf4j.Logger; |
49 | 49 | import org.slf4j.LoggerFactory; |
50 | 50 |
|
51 | | -import javax.crypto.BadPaddingException; |
52 | | -import javax.crypto.Cipher; |
53 | | -import javax.crypto.IllegalBlockSizeException; |
54 | | -import javax.crypto.SecretKey; |
55 | 51 | import java.io.IOException; |
56 | 52 | import java.io.UncheckedIOException; |
57 | 53 | import java.nio.charset.StandardCharsets; |
|
66 | 62 | import java.util.List; |
67 | 63 | import java.util.Map; |
68 | 64 | import java.util.function.Supplier; |
| 65 | +import javax.crypto.BadPaddingException; |
| 66 | +import javax.crypto.Cipher; |
| 67 | +import javax.crypto.IllegalBlockSizeException; |
| 68 | +import javax.crypto.SecretKey; |
69 | 69 |
|
70 | 70 | /** |
71 | 71 | * {@link HttpHelper} implementation that transparently handles client-side |
@@ -291,9 +291,19 @@ public MantaObjectInputStream httpRequestAsInputStream(final HttpUriRequest requ |
291 | 291 | + "client-side encryption is enabled unless the " |
292 | 292 | + "permit unencrypted downloads configuration setting " |
293 | 293 | + "is enabled"; |
294 | | - MantaClientEncryptionException e = new MantaClientEncryptionException(msg); |
295 | | - HttpHelper.annotateContextedException(e, request, response); |
296 | | - throw e; |
| 294 | + MantaClientEncryptionException mcee = new MantaClientEncryptionException(msg); |
| 295 | + HttpHelper.annotateContextedException(mcee, request, response); |
| 296 | + |
| 297 | + try { |
| 298 | + rawStream.close(); |
| 299 | + } catch (IOException ioe) { |
| 300 | + MantaIOException mioe = new MantaIOException(ioe); |
| 301 | + HttpHelper.annotateContextedException(mioe, request, response); |
| 302 | + LOGGER.warn("Error closing underlying stream", mioe); |
| 303 | + } |
| 304 | + |
| 305 | + throw mcee; |
| 306 | + |
297 | 307 | } |
298 | 308 | } |
299 | 309 |
|
|
0 commit comments