Andrew Gaul 2015-03-17 17:44:19 -07:00
rodzic 305ba9ae4c
commit 70a7a6ecf6
5 zmienionych plików z 28 dodań i 26 usunięć

Wyświetl plik

@ -195,7 +195,7 @@
<plugin>
<groupId>org.gaul</groupId>
<artifactId>modernizer-maven-plugin</artifactId>
<version>1.2.2</version>
<version>1.3.0</version>
<executions>
<execution>
<id>modernizer</id>

Wyświetl plik

@ -16,7 +16,7 @@
package org.gaul.s3proxy;
import static com.google.common.base.Preconditions.checkNotNull;
import static java.util.Objects.requireNonNull;
import javax.servlet.http.HttpServletResponse;
@ -75,7 +75,7 @@ enum S3ErrorCode {
this.errorCode = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL,
name());
this.httpStatusCode = httpStatusCode;
this.message = checkNotNull(message);
this.message = requireNonNull(message);
}
public String getErrorCode() {

Wyświetl plik

@ -16,8 +16,9 @@
package org.gaul.s3proxy;
import static java.util.Objects.requireNonNull;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import java.io.File;
import java.io.FileInputStream;
@ -58,8 +59,8 @@ public final class S3Proxy {
S3Proxy(BlobStore blobStore, URI endpoint, String identity,
String credential, String keyStorePath, String keyStorePassword,
Optional<String> virtualHost) {
checkNotNull(blobStore);
checkNotNull(endpoint);
requireNonNull(blobStore);
requireNonNull(endpoint);
// TODO: allow service paths?
checkArgument(endpoint.getPath().isEmpty(),
"endpoint path must be empty, was: %s", endpoint.getPath());
@ -67,12 +68,12 @@ public final class S3Proxy {
!Strings.isNullOrEmpty(credential),
"Must provide both identity and credential");
if (endpoint.getScheme().equals("https:")) {
checkNotNull(keyStorePath,
requireNonNull(keyStorePath,
"Must provide keyStorePath with HTTPS endpoint");
checkNotNull(keyStorePassword,
requireNonNull(keyStorePassword,
"Must provide keyStorePassword with HTTPS endpoint");
}
checkNotNull(virtualHost);
requireNonNull(virtualHost);
server = new Server();
HttpConnectionFactory httpConnectionFactory =
@ -113,29 +114,29 @@ public final class S3Proxy {
}
public Builder blobStore(BlobStore blobStore) {
this.blobStore = checkNotNull(blobStore);
this.blobStore = requireNonNull(blobStore);
return this;
}
public Builder endpoint(URI endpoint) {
this.endpoint = checkNotNull(endpoint);
this.endpoint = requireNonNull(endpoint);
return this;
}
public Builder awsAuthentication(String identity, String credential) {
this.identity = checkNotNull(identity);
this.credential = checkNotNull(credential);
this.identity = requireNonNull(identity);
this.credential = requireNonNull(credential);
return this;
}
public Builder keyStore(String keyStorePath, String keyStorePassword) {
this.keyStorePath = checkNotNull(keyStorePath);
this.keyStorePassword = checkNotNull(keyStorePassword);
this.keyStorePath = requireNonNull(keyStorePath);
this.keyStorePassword = requireNonNull(keyStorePassword);
return this;
}
public Builder virtualHost(String virtualHost) {
this.virtualHost = checkNotNull(virtualHost);
this.virtualHost = requireNonNull(virtualHost);
return this;
}
}

Wyświetl plik

@ -16,8 +16,9 @@
package org.gaul.s3proxy;
import static java.util.Objects.requireNonNull;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import java.io.IOException;
import java.io.InputStream;
@ -160,12 +161,12 @@ final class S3ProxyHandler extends AbstractHandler {
S3ProxyHandler(BlobStore blobStore, String identity, String credential,
Optional<String> virtualHost) {
this.blobStore = checkNotNull(blobStore);
this.blobStore = requireNonNull(blobStore);
this.blobStoreType =
blobStore.getContext().unwrap().getProviderMetadata().getId();
this.identity = identity;
this.credential = credential;
this.virtualHost = checkNotNull(virtualHost);
this.virtualHost = requireNonNull(virtualHost);
xmlOutputFactory.setProperty("javax.xml.stream.isRepairingNamespaces",
Boolean.FALSE);
}
@ -1639,7 +1640,7 @@ final class S3ProxyHandler extends AbstractHandler {
S3Exception(S3ErrorCode error, Throwable cause) {
super(cause);
this.error = checkNotNull(error);
this.error = requireNonNull(error);
}
S3ErrorCode getError() {
@ -1816,9 +1817,9 @@ final class S3ProxyHandler extends AbstractHandler {
MultiBlobByteSource(BlobStore blobStore, String containerName,
Collection<String> blobNames) {
this.blobStore = checkNotNull(blobStore);
this.containerName = checkNotNull(containerName);
this.blobNames = checkNotNull(blobNames);
this.blobStore = requireNonNull(blobStore);
this.containerName = requireNonNull(containerName);
this.blobNames = requireNonNull(blobNames);
}
@Override
@ -1836,8 +1837,8 @@ final class S3ProxyHandler extends AbstractHandler {
MultiBlobInputStream(BlobStore blobStore, String containerName,
Collection<String> blobNames) throws IOException {
this.blobStore = checkNotNull(blobStore);
this.containerName = checkNotNull(containerName);
this.blobStore = requireNonNull(blobStore);
this.containerName = requireNonNull(containerName);
this.blobNames = blobNames.iterator();
resetInputStream();
}

Wyświetl plik

@ -17,7 +17,7 @@
<module name="AvoidNestedBlocks"/>
<module name="AvoidStarImport"/>
<module name="AvoidStaticImport">
<property name="excludes" value="com.google.common.base.Preconditions.checkArgument,com.google.common.base.Preconditions.checkNotNull,com.google.common.base.Preconditions.checkState,org.assertj.core.api.Assertions.assertThat,org.junit.Assert.fail"/>
<property name="excludes" value="java.util.Objects.requireNonNull,com.google.common.base.Preconditions.checkArgument,com.google.common.base.Preconditions.checkState,org.assertj.core.api.Assertions.assertThat,org.junit.Assert.fail"/>
</module>
<module name="ClassTypeParameterName"/>
<module name="CovariantEquals"/>