diff options
author | Christian Halstrick <christian.halstrick@sap.com> | 2012-03-06 09:26:38 -0500 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org <gerrit@eclipse.org> | 2012-03-06 09:26:38 -0500 |
commit | e05300b21d5a0479eb278ee38c6d19c956e926f4 (patch) | |
tree | 194abb998cca544afca2a764f752a01371d04205 | |
parent | 8b1eee47d230a7ea896bed23fc257feeb7135ab5 (diff) | |
parent | 2c6187697c700654adc193d040e803a5438400f8 (diff) | |
download | jgit-e05300b21d5a0479eb278ee38c6d19c956e926f4.tar.gz jgit-e05300b21d5a0479eb278ee38c6d19c956e926f4.zip |
Merge "Check connection's error stream before reading from it"
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java index 0430b5fdca..90378344d6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java @@ -512,10 +512,14 @@ public class AmazonS3 { final HttpURLConnection c) throws IOException { final IOException err = new IOException(MessageFormat.format(JGitText.get().amazonS3ActionFailed , action, key, HttpSupport.response(c), c.getResponseMessage())); + final InputStream errorStream = c.getErrorStream(); + if (errorStream == null) + return err; + final ByteArrayOutputStream b = new ByteArrayOutputStream(); byte[] buf = new byte[2048]; for (;;) { - final int n = c.getErrorStream().read(buf); + final int n = errorStream.read(buf); if (n < 0) break; if (n > 0) |