Emit RequestTimeout when putBlob times out

Found with Ceph s3-tests.  References #5.
pull/16/head
Andrew Gaul 2014-08-01 21:48:26 -07:00
rodzic 5d069b26b7
commit df13f8247c
1 zmienionych plików z 12 dodań i 0 usunięć

Wyświetl plik

@ -30,6 +30,7 @@ import java.util.Enumeration;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeoutException;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
@ -63,6 +64,7 @@ import org.jclouds.blobstore.options.ListContainerOptions;
import org.jclouds.domain.Location;
import org.jclouds.http.HttpResponseException;
import org.jclouds.io.ContentMetadata;
import org.jclouds.util.Throwables2;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -610,6 +612,16 @@ final class S3ProxyHandler extends AbstractHandler {
response.sendError(status);
}
return;
} catch (RuntimeException re) {
if (Throwables2.getFirstThrowableOfType(re,
TimeoutException.class) != null) {
sendSimpleErrorResponse(response,
HttpServletResponse.SC_BAD_REQUEST,
"RequestTimeout", "Bad Request");
return;
} else {
throw re;
}
}
} catch (IOException ioe) {
logger.error("Error reading from client: {}", ioe.getMessage());