Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion common-core/src/main/java/io/cdap/common/ImmutablePair.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.cdap.common;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;

/**
Expand Down Expand Up @@ -79,7 +80,7 @@ public B getSecond() {
*/
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("first", first)
.add("second", second)
.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.io.InputSupplier;
import com.google.common.io.ByteSource;
import io.cdap.common.ContentProvider;
import io.cdap.common.io.ByteBufferInputStream;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
Expand Down Expand Up @@ -166,11 +165,11 @@ public Builder addHeaders(@Nullable Map<String, String> headers) {
return this;
}

public Builder withBody(InputSupplier<? extends InputStream> body) {
public Builder withBody(ByteSource body) {
return withBody(new ContentProvider<InputStream>() {
@Override
public InputStream getInput() throws IOException {
return body.getInput();
return body.openStream();
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ public class HttpRequestsStreamTest extends HttpRequestsTestBase {
@Before
public void setUp() throws Exception {
httpService = new TestHttpService(false);
httpService.startAndWait();
httpService.startAsync().awaitRunning();
}

@After
public void tearDown() {
httpService.stopAndWait();
httpService.stopAsync().awaitTerminated();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ public class HttpRequestsTest extends HttpRequestsTestBase {
@Before
public void setUp() throws Exception {
httpService = new TestHttpService(false);
httpService.startAndWait();
httpService.startAsync().awaitRunning();
}

@After
public void tearDown() {
httpService.stopAndWait();
httpService.stopAsync().awaitTerminated();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ public class HttpsRequestsTest extends HttpRequestsTestBase {
@Before
public void setUp() throws Exception {
httpsService = new TestHttpService(true);
httpsService.startAndWait();
httpsService.startAsync().awaitRunning();
}

@After
public void tearDown() {
httpsService.stopAndWait();
httpsService.stopAsync().awaitTerminated();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,20 @@

package io.cdap.common.http;

import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.google.common.util.concurrent.AbstractIdleService;
import io.cdap.http.ChannelPipelineModifier;
import io.cdap.http.NettyHttpService;
import io.cdap.http.SSLConfig;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelPipeline;
import org.junit.Assert;

import java.io.File;
import java.net.InetSocketAddress;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.Assert;

/**
* Service for testing {@link HttpRequests}.
Expand Down Expand Up @@ -90,7 +89,7 @@ public int getNumConnectionsOpened() {

@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("bindAddress", httpService.getBindAddress())
.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.cdap.common.internal.io;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;

import java.lang.reflect.ParameterizedType;
Expand Down Expand Up @@ -117,8 +118,8 @@ public Type[] getActualTypeArguments() {
@Override
public Type getRawType() {
try {
ClassLoader cl = Objects.firstNonNull(classLoader,
Objects.firstNonNull(Thread.currentThread().getContextClassLoader(),
ClassLoader cl = MoreObjects.firstNonNull(classLoader,
MoreObjects.firstNonNull(Thread.currentThread().getContextClassLoader(),
getClass().getClassLoader()));
return cl.loadClass(this.rawType);
} catch (ClassNotFoundException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.cdap.common.lang;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;

import javax.annotation.Nullable;
Expand All @@ -39,7 +40,7 @@ private ClassLoaders() { }
*/
public static Class<?> loadClass(String className, @Nullable ClassLoader classLoader,
Object caller) throws ClassNotFoundException {
ClassLoader cl = Objects.firstNonNull(classLoader, caller.getClass().getClassLoader());
ClassLoader cl = MoreObjects.firstNonNull(classLoader, caller.getClass().getClassLoader());
return cl.loadClass(className);
}

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ the License.
<asm.version>7.1</asm.version>
<findbugs.jsr305.version>2.0.1</findbugs.jsr305.version>
<geronimo.version>2.0.0</geronimo.version>
<guava.version>13.0.1</guava.version>
<guava.version>32.0.0-jre</guava.version>
<guice.version>4.0</guice.version>
<gson.version>2.2.4</gson.version>
<netty.http.version>1.5.0</netty.http.version>
Expand Down