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> <plugin>
<groupId>org.gaul</groupId> <groupId>org.gaul</groupId>
<artifactId>modernizer-maven-plugin</artifactId> <artifactId>modernizer-maven-plugin</artifactId>
<version>1.2.2</version> <version>1.3.0</version>
<executions> <executions>
<execution> <execution>
<id>modernizer</id> <id>modernizer</id>

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -17,7 +17,7 @@
<module name="AvoidNestedBlocks"/> <module name="AvoidNestedBlocks"/>
<module name="AvoidStarImport"/> <module name="AvoidStarImport"/>
<module name="AvoidStaticImport"> <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>
<module name="ClassTypeParameterName"/> <module name="ClassTypeParameterName"/>
<module name="CovariantEquals"/> <module name="CovariantEquals"/>