kopia lustrzana https://github.com/gaul/s3proxy
Prefer Java 9 InputStream.readAllBytes
rodzic
595a7f918c
commit
83bc9f7f7f
|
@ -28,7 +28,6 @@ import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.hash.HashCode;
|
import com.google.common.hash.HashCode;
|
||||||
import com.google.common.io.ByteSource;
|
import com.google.common.io.ByteSource;
|
||||||
import com.google.common.io.ByteStreams;
|
|
||||||
import com.google.common.primitives.Longs;
|
import com.google.common.primitives.Longs;
|
||||||
|
|
||||||
import org.jclouds.blobstore.BlobStore;
|
import org.jclouds.blobstore.BlobStore;
|
||||||
|
@ -81,7 +80,7 @@ final class NullBlobStore extends ForwardingBlobStore {
|
||||||
|
|
||||||
byte[] array;
|
byte[] array;
|
||||||
try (InputStream is = blob.getPayload().openStream()) {
|
try (InputStream is = blob.getPayload().openStream()) {
|
||||||
array = ByteStreams.toByteArray(is);
|
array = is.readAllBytes();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
throw new RuntimeException(ioe);
|
throw new RuntimeException(ioe);
|
||||||
}
|
}
|
||||||
|
|
|
@ -577,8 +577,8 @@ public class S3ProxyHandler {
|
||||||
} else {
|
} else {
|
||||||
// buffer the entire stream to calculate digest
|
// buffer the entire stream to calculate digest
|
||||||
// why input stream read contentlength of header?
|
// why input stream read contentlength of header?
|
||||||
payload = ByteStreams.toByteArray(ByteStreams.limit(
|
payload = ByteStreams.limit(is, v4MaxNonChunkedRequestSize + 1)
|
||||||
is, v4MaxNonChunkedRequestSize + 1));
|
.readAllBytes();
|
||||||
if (payload.length == v4MaxNonChunkedRequestSize + 1) {
|
if (payload.length == v4MaxNonChunkedRequestSize + 1) {
|
||||||
throw new S3Exception(
|
throw new S3Exception(
|
||||||
S3ErrorCode.MAX_MESSAGE_LENGTH_EXCEEDED);
|
S3ErrorCode.MAX_MESSAGE_LENGTH_EXCEEDED);
|
||||||
|
|
Ładowanie…
Reference in New Issue