|
|
@ -529,21 +529,29 @@ public class AmazonS3 { |
|
|
|
Integer.valueOf(HttpSupport.response(c)), |
|
|
|
Integer.valueOf(HttpSupport.response(c)), |
|
|
|
c.getResponseMessage())); |
|
|
|
c.getResponseMessage())); |
|
|
|
final InputStream errorStream = c.getErrorStream(); |
|
|
|
final InputStream errorStream = c.getErrorStream(); |
|
|
|
if (errorStream == null) |
|
|
|
if (errorStream == null) { |
|
|
|
return err; |
|
|
|
return err; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
final ByteArrayOutputStream b = new ByteArrayOutputStream(); |
|
|
|
final ByteArrayOutputStream b = new ByteArrayOutputStream(); |
|
|
|
byte[] buf = new byte[2048]; |
|
|
|
byte[] buf = new byte[2048]; |
|
|
|
for (;;) { |
|
|
|
for (;;) { |
|
|
|
final int n = errorStream.read(buf); |
|
|
|
final int n = errorStream.read(buf); |
|
|
|
if (n < 0) |
|
|
|
if (n < 0) { |
|
|
|
break; |
|
|
|
break; |
|
|
|
if (n > 0) |
|
|
|
} |
|
|
|
|
|
|
|
if (n > 0) { |
|
|
|
b.write(buf, 0, n); |
|
|
|
b.write(buf, 0, n); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
buf = b.toByteArray(); |
|
|
|
buf = b.toByteArray(); |
|
|
|
if (buf.length > 0) |
|
|
|
if (buf.length > 0) { |
|
|
|
err.initCause(new IOException("\n" + new String(buf))); //$NON-NLS-1$
|
|
|
|
err.initCause(new IOException("\n" + new String(buf))); //$NON-NLS-1$
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
errorStream.close(); |
|
|
|
|
|
|
|
} |
|
|
|
return err; |
|
|
|
return err; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|