kopia lustrzana https://github.com/gaul/s3proxy
Remove explicit dependency on Apache commons-io
commons-fileupload2-javax exposes this as an implicit dependency but S3Proxy can replace its uses with Guava and modern Java.pull/763/head
rodzic
86aceaf45e
commit
b8bd258dcd
|
@ -26,8 +26,8 @@ import javax.annotation.concurrent.ThreadSafe;
|
|||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.io.input.BoundedInputStream;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
import org.jclouds.blobstore.BlobStore;
|
||||
import org.jclouds.blobstore.domain.Blob;
|
||||
import org.jclouds.blobstore.domain.BlobMetadata;
|
||||
|
@ -211,10 +211,10 @@ public class Decryption {
|
|||
if (this.skipFirstBlock) {
|
||||
offset = offset + Constants.AES_BLOCK_SIZE;
|
||||
}
|
||||
IOUtils.skipFully(dis, offset);
|
||||
ByteStreams.skipFully(dis, offset);
|
||||
|
||||
// trim the stream to a specific length if needed
|
||||
return new BoundedInputStream(dis, outputLength);
|
||||
return outputLength >= 0 ? ByteStreams.limit(dis, outputLength) : dis;
|
||||
}
|
||||
|
||||
private void calculateOffset(long offset) {
|
||||
|
|
|
@ -26,8 +26,6 @@ import javax.crypto.Cipher;
|
|||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.ShortBufferException;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
@ThreadSafe
|
||||
public class DecryptionInputStream extends FilterInputStream {
|
||||
|
||||
|
@ -176,7 +174,8 @@ public class DecryptionInputStream extends FilterInputStream {
|
|||
// update the remaining bytes of the next part
|
||||
partBytesRemain = parts.get(nextPart).getSize();
|
||||
|
||||
IOUtils.skip(in, Constants.PADDING_BLOCK_SIZE);
|
||||
// Cannot call ByteStreams.skipFully since in may be shorter
|
||||
in.readNBytes(Constants.PADDING_BLOCK_SIZE);
|
||||
|
||||
return ofinish;
|
||||
} else {
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.util.Arrays;
|
|||
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.jclouds.blobstore.domain.Blob;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -43,7 +42,7 @@ public class PartPadding {
|
|||
var partPadding = new PartPadding();
|
||||
|
||||
try (var is = blob.getPayload().openStream()) {
|
||||
byte[] paddingBytes = IOUtils.toByteArray(is);
|
||||
byte[] paddingBytes = is.readAllBytes();
|
||||
ByteBuffer bb = ByteBuffer.wrap(paddingBytes);
|
||||
|
||||
byte[] delimiterBytes =
|
||||
|
|
|
@ -22,7 +22,8 @@ import java.net.URI;
|
|||
import java.nio.file.Files;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import com.google.common.io.MoreFiles;
|
||||
|
||||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
import org.gaul.s3proxy.AuthenticationType;
|
||||
import org.gaul.s3proxy.S3Proxy;
|
||||
|
@ -164,7 +165,11 @@ public class S3ProxyJunitCore {
|
|||
} catch (Exception e) {
|
||||
throw new RuntimeException("Unable to stop S3 proxy", e);
|
||||
}
|
||||
FileUtils.deleteQuietly(blobStoreLocation);
|
||||
try {
|
||||
MoreFiles.deleteRecursively(blobStoreLocation.toPath());
|
||||
} catch (IOException ioe) {
|
||||
// ignore
|
||||
}
|
||||
logger.debug("S3 proxy has stopped");
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue