/// <exception cref="System.IO.IOException"></exception>
private IOException Error(string action, string key, HttpURLConnection c)
{
IOException err = new IOException(MessageFormat.Format(JGitText.Get().amazonS3ActionFailed
, action, key, HttpSupport.Response(c), c.GetResponseMessage()));
ByteArrayOutputStream b = new ByteArrayOutputStream();
byte[] buf = new byte[2048];
for (; ; )
{
int n = c.GetErrorStream().Read(buf);
if (n < 0)
{
break;
}
if (n > 0)
{
b.Write(buf, 0, n);
}
}
buf = b.ToByteArray();
if (buf.Length > 0)
{
Sharpen.Extensions.InitCause(err, new IOException("\n" + Sharpen.Extensions.CreateString
(buf)));
}
return err;
}