mirror of https://github.com/apache/jclouds.git
Throw consistent exception on invalid range read
Previously S3, Swift, and local blobstores threw a generic IllegalArgumentException for this uncommon error. Instead consistently throw HttpResponseException.
This commit is contained in:
parent
c468c60d51
commit
8b94febfeb
|
@ -77,9 +77,6 @@ public class CloudFilesErrorHandler implements HttpErrorHandler {
|
||||||
case 413:
|
case 413:
|
||||||
exception = new InsufficientResourcesException(exception.getMessage(), exception);
|
exception = new InsufficientResourcesException(exception.getMessage(), exception);
|
||||||
break;
|
break;
|
||||||
case 416:
|
|
||||||
exception = new IllegalArgumentException(exception.getMessage(), exception);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
command.setException(exception);
|
command.setException(exception);
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,11 +133,6 @@ public class ParseAWSErrorFromXmlContent implements HttpErrorHandler {
|
||||||
exception = new IllegalStateException(message, exception);
|
exception = new IllegalStateException(message, exception);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 416:
|
|
||||||
if ("InvalidRange".equals(errorCode)) {
|
|
||||||
exception = new IllegalArgumentException(message, exception);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return exception;
|
return exception;
|
||||||
}
|
}
|
||||||
|
|
|
@ -704,11 +704,11 @@ public final class LocalBlobStore implements BlobStore {
|
||||||
offset = Long.parseLong(firstLast[0]);
|
offset = Long.parseLong(firstLast[0]);
|
||||||
last = Long.parseLong(firstLast[1]);
|
last = Long.parseLong(firstLast[1]);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("illegal range: " + s);
|
throw new HttpResponseException("illegal range: " + s, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset >= blob.getPayload().getContentMetadata().getContentLength()) {
|
if (offset >= blob.getPayload().getContentMetadata().getContentLength()) {
|
||||||
throw new IllegalArgumentException("illegal range: " + s);
|
throw new HttpResponseException("illegal range: " + s, null, null);
|
||||||
}
|
}
|
||||||
if (last + 1 > blob.getPayload().getContentMetadata().getContentLength()) {
|
if (last + 1 > blob.getPayload().getContentMetadata().getContentLength()) {
|
||||||
last = blob.getPayload().getContentMetadata().getContentLength() - 1;
|
last = blob.getPayload().getContentMetadata().getContentLength() - 1;
|
||||||
|
|
Loading…
Reference in New Issue