From 83a2d934590977aa4cd51d2e9236e26f43925586 Mon Sep 17 00:00:00 2001 From: "adrian.f.cole" Date: Mon, 29 Jun 2009 14:41:56 +0000 Subject: [PATCH] Issue 71: retry on 400/RequestTimeout and 409/OperationAborted git-svn-id: http://jclouds.googlecode.com/svn/trunk@1495 3d8758e0-26b5-11de-8745-db77d3ebf521 --- .../jclouds/aws/s3/handlers/AWSClientErrorRetryHandler.java | 5 +++-- .../org/jclouds/http/commands/callables/xml/ParseSax.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/aws/s3/core/src/main/java/org/jclouds/aws/s3/handlers/AWSClientErrorRetryHandler.java b/aws/s3/core/src/main/java/org/jclouds/aws/s3/handlers/AWSClientErrorRetryHandler.java index b69ded86a3..7c7e279ad7 100644 --- a/aws/s3/core/src/main/java/org/jclouds/aws/s3/handlers/AWSClientErrorRetryHandler.java +++ b/aws/s3/core/src/main/java/org/jclouds/aws/s3/handlers/AWSClientErrorRetryHandler.java @@ -60,13 +60,14 @@ public class AWSClientErrorRetryHandler implements HttpRetryHandler { public boolean shouldRetryRequest(HttpFutureCommand command, HttpResponse response) { if (command.getFailureCount() > retryCountLimit) return false; - if (response.getStatusCode() == 400) { + if (response.getStatusCode() == 400 || response.getStatusCode() == 409) { byte[] content = S3Utils.closeConnectionButKeepContentStream(response); command.incrementRedirectCount(); try { AWSError error = S3Utils.parseAWSErrorFromContent(parserFactory, command, response, new String(content)); - if ("RequestTimeout".equals(error.getCode())) { + if ("RequestTimeout".equals(error.getCode()) + || "OperationAborted".equals(error.getCode())) { return true; } } catch (HttpException e) { diff --git a/core/src/main/java/org/jclouds/http/commands/callables/xml/ParseSax.java b/core/src/main/java/org/jclouds/http/commands/callables/xml/ParseSax.java index 14328dc37a..667786a7de 100644 --- a/core/src/main/java/org/jclouds/http/commands/callables/xml/ParseSax.java +++ b/core/src/main/java/org/jclouds/http/commands/callables/xml/ParseSax.java @@ -93,7 +93,7 @@ public class ParseSax extends HttpFutureCommand.ResponseCallable { IOUtils.closeQuietly(xml); xml = IOUtils.toInputStream(response); } - InputSource input = new InputSource(new InputStreamReader(xml,"UTF-8")); + InputSource input = new InputSource(new InputStreamReader(xml, "UTF-8")); parser.parse(input); } catch (Exception e) { StringBuilder message = new StringBuilder();