JGitText.get().amazonS3ActionFailed, action, key,
Integer.valueOf(HttpSupport.response(c)),
c.getResponseMessage()));
- final InputStream errorStream = c.getErrorStream();
- if (errorStream == null) {
+ if (c.getErrorStream() == null) {
return err;
}
- try {
+ try (InputStream errorStream = c.getErrorStream()) {
final ByteArrayOutputStream b = new ByteArrayOutputStream();
byte[] buf = new byte[2048];
for (;;) {
if (buf.length > 0) {
err.initCause(new IOException("\n" + new String(buf))); //$NON-NLS-1$
}
- } finally {
- errorStream.close();
}
return err;
}