diff --git a/apis/byon/src/main/java/org/jclouds/byon/domain/YamlNode.java b/apis/byon/src/main/java/org/jclouds/byon/domain/YamlNode.java index 0171fbb063..58cd7b2ec7 100644 --- a/apis/byon/src/main/java/org/jclouds/byon/domain/YamlNode.java +++ b/apis/byon/src/main/java/org/jclouds/byon/domain/YamlNode.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Map; import org.jclouds.byon.Node; +import org.jclouds.util.Closeables2; import org.jclouds.util.Strings2; import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Loader; @@ -34,7 +35,6 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.ImmutableMap.Builder; -import com.google.common.io.Closeables; /** * Serializes to the following @@ -114,7 +114,7 @@ public class YamlNode { try { return (YamlNode) new Yaml(new Loader(new Constructor(YamlNode.class))).load(in); } finally { - Closeables.closeQuietly(in); + Closeables2.closeQuietly(in); } } }; diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/handlers/CloudSigmaErrorHandler.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/handlers/CloudSigmaErrorHandler.java index ec41b86dff..73bdb17e69 100644 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/handlers/CloudSigmaErrorHandler.java +++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/handlers/CloudSigmaErrorHandler.java @@ -28,10 +28,10 @@ import org.jclouds.http.HttpResponseException; import org.jclouds.logging.Logger; import org.jclouds.rest.AuthorizationException; import org.jclouds.rest.ResourceNotFoundException; +import org.jclouds.util.Closeables2; import org.jclouds.util.Strings2; import com.google.common.base.Throwables; -import com.google.common.io.Closeables; /** * This will parse and set an appropriate exception on the command object. @@ -82,7 +82,7 @@ public class CloudSigmaErrorHandler implements HttpErrorHandler { break; } } finally { - Closeables.closeQuietly(response.getPayload()); + Closeables2.closeQuietly(response.getPayload()); command.setException(exception); } } diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/handlers/CloudStackErrorHandler.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/handlers/CloudStackErrorHandler.java index 667e260aa9..9438be6ca5 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/handlers/CloudStackErrorHandler.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/handlers/CloudStackErrorHandler.java @@ -29,10 +29,10 @@ import org.jclouds.logging.Logger; import org.jclouds.rest.AuthorizationException; import org.jclouds.rest.InsufficientResourcesException; import org.jclouds.rest.ResourceNotFoundException; +import org.jclouds.util.Closeables2; import org.jclouds.util.Strings2; import com.google.common.base.Throwables; -import com.google.common.io.Closeables; /** * @@ -86,7 +86,7 @@ public class CloudStackErrorHandler implements HttpErrorHandler { break; } } finally { - Closeables.closeQuietly(response.getPayload()); + Closeables2.closeQuietly(response.getPayload()); command.setException(exception); } } diff --git a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/handlers/ElasticStackErrorHandler.java b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/handlers/ElasticStackErrorHandler.java index 7348348530..5b6e1a4ed1 100644 --- a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/handlers/ElasticStackErrorHandler.java +++ b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/handlers/ElasticStackErrorHandler.java @@ -28,10 +28,10 @@ import org.jclouds.http.HttpResponseException; import org.jclouds.logging.Logger; import org.jclouds.rest.AuthorizationException; import org.jclouds.rest.ResourceNotFoundException; +import org.jclouds.util.Closeables2; import org.jclouds.util.Strings2; import com.google.common.base.Throwables; -import com.google.common.io.Closeables; /** * This will parse and set an appropriate exception on the command object. @@ -80,7 +80,7 @@ public class ElasticStackErrorHandler implements HttpErrorHandler { break; } } finally { - Closeables.closeQuietly(response.getPayload()); + Closeables2.closeQuietly(response.getPayload()); command.setException(exception); } } diff --git a/apis/filesystem/src/test/java/org/jclouds/filesystem/FilesystemAsyncBlobStoreTest.java b/apis/filesystem/src/test/java/org/jclouds/filesystem/FilesystemAsyncBlobStoreTest.java index aef2383fb3..dd5d523f3a 100644 --- a/apis/filesystem/src/test/java/org/jclouds/filesystem/FilesystemAsyncBlobStoreTest.java +++ b/apis/filesystem/src/test/java/org/jclouds/filesystem/FilesystemAsyncBlobStoreTest.java @@ -53,6 +53,7 @@ import org.jclouds.http.HttpRequest; import org.jclouds.io.Payload; import org.jclouds.io.payloads.PhantomPayload; import org.jclouds.io.payloads.StringPayload; +import org.jclouds.util.Closeables2; import org.jclouds.util.Strings2; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; @@ -60,7 +61,6 @@ import org.testng.annotations.Test; import com.google.common.collect.Sets; import com.google.common.io.ByteStreams; -import com.google.common.io.Closeables; import com.google.common.io.Files; import com.google.common.io.InputSupplier; import com.google.inject.CreationException; @@ -710,7 +710,7 @@ public class FilesystemAsyncBlobStoreTest { try { assertEquals(input.substring(1), Strings2.toString(payload)); } finally { - Closeables.closeQuietly(payload); + Closeables2.closeQuietly(payload); } GetOptions getOptionsRangeTail = new GetOptions(); @@ -720,7 +720,7 @@ public class FilesystemAsyncBlobStoreTest { try { assertEquals(input.substring(5), Strings2.toString(payload)); } finally { - Closeables.closeQuietly(payload); + Closeables2.closeQuietly(payload); } GetOptions getOptionsFragment = new GetOptions(); @@ -730,7 +730,7 @@ public class FilesystemAsyncBlobStoreTest { try { assertEquals(input.substring(4, 7), Strings2.toString(payload)); } finally { - Closeables.closeQuietly(payload); + Closeables2.closeQuietly(payload); } } diff --git a/blobstore/src/main/java/org/jclouds/blobstore/internal/BlobStoreContextImpl.java b/blobstore/src/main/java/org/jclouds/blobstore/internal/BlobStoreContextImpl.java index 32f32aabd4..67ae76dc2e 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/internal/BlobStoreContextImpl.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/internal/BlobStoreContextImpl.java @@ -30,8 +30,8 @@ import org.jclouds.blobstore.attr.ConsistencyModel; import org.jclouds.internal.BaseView; import org.jclouds.location.Provider; import org.jclouds.rest.Utils; +import org.jclouds.util.Closeables2; -import com.google.common.io.Closeables; import com.google.common.reflect.TypeToken; /** @@ -85,7 +85,7 @@ public class BlobStoreContextImpl extends BaseView implements BlobStoreContext { @Override public void close() { - Closeables.closeQuietly(delegate()); + Closeables2.closeQuietly(delegate()); } public int hashCode() { diff --git a/blobstore/src/test/java/org/jclouds/blobstore/strategy/internal/ConcatenateContainerListsTest.java b/blobstore/src/test/java/org/jclouds/blobstore/strategy/internal/ConcatenateContainerListsTest.java index 77185c9fc3..73178169eb 100644 --- a/blobstore/src/test/java/org/jclouds/blobstore/strategy/internal/ConcatenateContainerListsTest.java +++ b/blobstore/src/test/java/org/jclouds/blobstore/strategy/internal/ConcatenateContainerListsTest.java @@ -22,12 +22,12 @@ import org.jclouds.ContextBuilder; import org.jclouds.blobstore.BlobStore; import org.jclouds.blobstore.domain.StorageMetadata; import org.jclouds.blobstore.options.ListContainerOptions; +import org.jclouds.util.Closeables2; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.google.common.collect.Iterables; -import com.google.common.io.Closeables; import com.google.inject.Injector; /** @@ -75,6 +75,6 @@ public class ConcatenateContainerListsTest { @AfterClass void close() { if (blobstore != null) - Closeables.closeQuietly(blobstore.getContext()); + Closeables2.closeQuietly(blobstore.getContext()); } } diff --git a/blobstore/src/test/java/org/jclouds/blobstore/strategy/internal/DeleteAllKeysInListTest.java b/blobstore/src/test/java/org/jclouds/blobstore/strategy/internal/DeleteAllKeysInListTest.java index bcb93bb451..016fc23b8c 100644 --- a/blobstore/src/test/java/org/jclouds/blobstore/strategy/internal/DeleteAllKeysInListTest.java +++ b/blobstore/src/test/java/org/jclouds/blobstore/strategy/internal/DeleteAllKeysInListTest.java @@ -22,11 +22,11 @@ import static org.testng.Assert.assertEquals; import org.jclouds.ContextBuilder; import org.jclouds.blobstore.BlobStore; import org.jclouds.blobstore.options.ListContainerOptions; +import org.jclouds.util.Closeables2; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import com.google.common.io.Closeables; import com.google.inject.Injector; /** @@ -50,7 +50,7 @@ public class DeleteAllKeysInListTest { @AfterMethod void close() { - Closeables.closeQuietly(blobstore.getContext()); + Closeables2.closeQuietly(blobstore.getContext()); } public void testExecuteWithoutOptionsClearsRecursively() { diff --git a/compute/src/main/java/org/jclouds/compute/domain/ExecChannel.java b/compute/src/main/java/org/jclouds/compute/domain/ExecChannel.java index f2fd2c1047..a40627e346 100644 --- a/compute/src/main/java/org/jclouds/compute/domain/ExecChannel.java +++ b/compute/src/main/java/org/jclouds/compute/domain/ExecChannel.java @@ -23,8 +23,9 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import org.jclouds.util.Closeables2; + import com.google.common.base.Supplier; -import com.google.common.io.Closeables; /** * A current connection to an exec'd command. Please ensure you call {@link ExecChannel#close} @@ -86,9 +87,9 @@ public class ExecChannel implements Closeable { */ @Override public void close() throws IOException { - Closeables.closeQuietly(input); - Closeables.closeQuietly(output); - Closeables.closeQuietly(error); + Closeables2.closeQuietly(input); + Closeables2.closeQuietly(output); + Closeables2.closeQuietly(error); closer.close(); } } diff --git a/core/src/main/java/org/jclouds/crypto/Pems.java b/core/src/main/java/org/jclouds/crypto/Pems.java index 36b3525064..65afc42e70 100644 --- a/core/src/main/java/org/jclouds/crypto/Pems.java +++ b/core/src/main/java/org/jclouds/crypto/Pems.java @@ -26,10 +26,10 @@ import static com.google.common.base.Throwables.propagate; import static com.google.common.base.Throwables.propagateIfInstanceOf; import static com.google.common.io.BaseEncoding.base64; import static com.google.common.io.ByteStreams.readBytes; -import static com.google.common.io.Closeables.closeQuietly; import static org.jclouds.crypto.ASN1Codec.decodeRSAPrivateKey; import static org.jclouds.crypto.ASN1Codec.decodeRSAPublicKey; import static org.jclouds.crypto.ASN1Codec.encode; +import static org.jclouds.util.Closeables2.closeQuietly; import java.io.BufferedReader; import java.io.ByteArrayInputStream; diff --git a/core/src/main/java/org/jclouds/http/HttpUtils.java b/core/src/main/java/org/jclouds/http/HttpUtils.java index 6e41625cf9..baf582bcce 100644 --- a/core/src/main/java/org/jclouds/http/HttpUtils.java +++ b/core/src/main/java/org/jclouds/http/HttpUtils.java @@ -30,7 +30,6 @@ import static com.google.common.collect.Iterables.size; import static com.google.common.collect.Multimaps.filterKeys; import static com.google.common.io.BaseEncoding.base64; import static com.google.common.io.ByteStreams.toByteArray; -import static com.google.common.io.Closeables.closeQuietly; import static com.google.common.net.HttpHeaders.CONTENT_DISPOSITION; import static com.google.common.net.HttpHeaders.CONTENT_ENCODING; import static com.google.common.net.HttpHeaders.CONTENT_LANGUAGE; @@ -38,6 +37,7 @@ import static com.google.common.net.HttpHeaders.CONTENT_LENGTH; import static com.google.common.net.HttpHeaders.CONTENT_MD5; import static com.google.common.net.HttpHeaders.CONTENT_TYPE; import static com.google.common.net.HttpHeaders.EXPIRES; +import static org.jclouds.util.Closeables2.closeQuietly; import java.io.IOException; import java.io.InputStream; diff --git a/core/src/main/java/org/jclouds/http/functions/ParseFirstJsonValueNamed.java b/core/src/main/java/org/jclouds/http/functions/ParseFirstJsonValueNamed.java index 071f5c81ae..5ead49d51b 100644 --- a/core/src/main/java/org/jclouds/http/functions/ParseFirstJsonValueNamed.java +++ b/core/src/main/java/org/jclouds/http/functions/ParseFirstJsonValueNamed.java @@ -30,12 +30,12 @@ import javax.annotation.Resource; import org.jclouds.http.HttpResponse; import org.jclouds.json.internal.GsonWrapper; import org.jclouds.logging.Logger; +import org.jclouds.util.Closeables2; import com.google.common.base.Function; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; -import com.google.common.io.Closeables; import com.google.common.util.concurrent.Atomics; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonToken; @@ -88,7 +88,7 @@ public class ParseFirstJsonValueNamed implements Function { throw new RuntimeException(String.format( "error reading from stream, parsing object named %s from http response %s", nameChoices, arg0), e); } finally { - Closeables.closeQuietly(reader); + Closeables2.closeQuietly(reader); arg0.getPayload().release(); } } diff --git a/core/src/main/java/org/jclouds/http/functions/ParseSax.java b/core/src/main/java/org/jclouds/http/functions/ParseSax.java index f8808722ec..5d440a2576 100644 --- a/core/src/main/java/org/jclouds/http/functions/ParseSax.java +++ b/core/src/main/java/org/jclouds/http/functions/ParseSax.java @@ -18,8 +18,8 @@ package org.jclouds.http.functions; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.io.Closeables.closeQuietly; import static org.jclouds.http.HttpUtils.closeClientButKeepContentStream; +import static org.jclouds.util.Closeables2.closeQuietly; import java.io.IOException; import java.io.InputStream; @@ -41,7 +41,7 @@ import org.xml.sax.helpers.DefaultHandler; import com.google.common.base.Function; import com.google.common.base.Throwables; -import com.google.common.io.Closeables; +import org.jclouds.util.Closeables2; /** * This object will parse the body of an HttpResponse and return the result of type back to the @@ -85,7 +85,7 @@ public class ParseSax implements Function, InvocationContext } catch (RuntimeException e) { return addDetailsAndPropagate(from, e); } finally { - Closeables.closeQuietly(is); + Closeables2.closeQuietly(is); from.getPayload().release(); } } diff --git a/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpCommandExecutorService.java b/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpCommandExecutorService.java index 3e2b5db092..55595d7291 100644 --- a/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpCommandExecutorService.java +++ b/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpCommandExecutorService.java @@ -19,12 +19,12 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Throwables.propagate; import static com.google.common.io.ByteStreams.toByteArray; -import static com.google.common.io.Closeables.closeQuietly; import static com.google.common.net.HttpHeaders.CONTENT_LENGTH; import static com.google.common.net.HttpHeaders.HOST; import static com.google.common.net.HttpHeaders.USER_AGENT; import static org.jclouds.http.HttpUtils.filterOutContentHeaders; import static org.jclouds.io.Payloads.newInputStreamPayload; +import static org.jclouds.util.Closeables2.closeQuietly; import java.io.ByteArrayInputStream; import java.io.IOException; diff --git a/core/src/main/java/org/jclouds/internal/ContextImpl.java b/core/src/main/java/org/jclouds/internal/ContextImpl.java index db399eb5fa..fbf85d22f0 100644 --- a/core/src/main/java/org/jclouds/internal/ContextImpl.java +++ b/core/src/main/java/org/jclouds/internal/ContextImpl.java @@ -19,9 +19,9 @@ package org.jclouds.internal; import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.toStringHelper; import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.io.Closeables.closeQuietly; import static org.jclouds.lifecycle.Closer.State.AVAILABLE; +import static org.jclouds.util.Closeables2.closeQuietly; import java.net.URI; import java.util.Map; diff --git a/core/src/main/java/org/jclouds/io/CopyInputStreamIntoSupplier.java b/core/src/main/java/org/jclouds/io/CopyInputStreamIntoSupplier.java index 7153a5360b..4ce2674957 100644 --- a/core/src/main/java/org/jclouds/io/CopyInputStreamIntoSupplier.java +++ b/core/src/main/java/org/jclouds/io/CopyInputStreamIntoSupplier.java @@ -22,11 +22,11 @@ import java.io.InputStream; import javax.annotation.Resource; import org.jclouds.logging.Logger; +import org.jclouds.util.Closeables2; import com.google.common.annotations.Beta; import com.google.common.base.Function; import com.google.common.io.ByteStreams; -import com.google.common.io.Closeables; import com.google.common.io.InputSupplier; /** @@ -56,7 +56,7 @@ public class CopyInputStreamIntoSupplier implements Function { } protected void initializeContext() { - Closeables.closeQuietly(context); + Closeables2.closeQuietly(context); context = createContext(setupProperties(), setupModules()); } @@ -140,6 +140,6 @@ public abstract class BaseContextLiveTest { @AfterClass(groups = { "integration", "live" }) protected void tearDownContext() { - Closeables.closeQuietly(context); + Closeables2.closeQuietly(context); } } diff --git a/core/src/test/java/org/jclouds/apis/BaseViewLiveTest.java b/core/src/test/java/org/jclouds/apis/BaseViewLiveTest.java index caf402e75c..1bfd810fbb 100644 --- a/core/src/test/java/org/jclouds/apis/BaseViewLiveTest.java +++ b/core/src/test/java/org/jclouds/apis/BaseViewLiveTest.java @@ -22,8 +22,8 @@ import java.util.Properties; import org.jclouds.Context; import org.jclouds.View; +import org.jclouds.util.Closeables2; -import com.google.common.io.Closeables; import com.google.common.reflect.TypeToken; import com.google.inject.Module; @@ -37,7 +37,7 @@ public abstract class BaseViewLiveTest extends BaseContextLiveTe @Override protected void initializeContext() { - Closeables.closeQuietly(context); + Closeables2.closeQuietly(context); view = createView(setupProperties(), setupModules()); context = view.unwrap(); } diff --git a/core/src/test/java/org/jclouds/http/BaseHttpCommandExecutorServiceIntegrationTest.java b/core/src/test/java/org/jclouds/http/BaseHttpCommandExecutorServiceIntegrationTest.java index 980ed96bdc..40855c2a21 100644 --- a/core/src/test/java/org/jclouds/http/BaseHttpCommandExecutorServiceIntegrationTest.java +++ b/core/src/test/java/org/jclouds/http/BaseHttpCommandExecutorServiceIntegrationTest.java @@ -18,12 +18,12 @@ package org.jclouds.http; import static com.google.common.hash.Hashing.md5; import static com.google.common.io.BaseEncoding.base64; -import static com.google.common.io.Closeables.closeQuietly; import static java.lang.String.format; import static org.jclouds.http.options.GetOptions.Builder.tail; import static org.jclouds.io.ByteSources.asByteSource; import static org.jclouds.io.Payloads.newFilePayload; import static org.jclouds.io.Payloads.newStringPayload; +import static org.jclouds.util.Closeables2.closeQuietly; import static org.jclouds.util.Throwables2.getFirstThrowableOfType; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; diff --git a/core/src/test/java/org/jclouds/http/BaseJettyTest.java b/core/src/test/java/org/jclouds/http/BaseJettyTest.java index 76d3dbcd5a..4885993a8d 100644 --- a/core/src/test/java/org/jclouds/http/BaseJettyTest.java +++ b/core/src/test/java/org/jclouds/http/BaseJettyTest.java @@ -23,7 +23,6 @@ import static com.google.common.io.ByteStreams.copy; import static com.google.common.io.ByteStreams.join; import static com.google.common.io.ByteStreams.newInputStreamSupplier; import static com.google.common.io.ByteStreams.toByteArray; -import static com.google.common.io.Closeables.closeQuietly; import static com.google.common.net.HttpHeaders.CONTENT_DISPOSITION; import static com.google.common.net.HttpHeaders.CONTENT_ENCODING; import static com.google.common.net.HttpHeaders.CONTENT_LANGUAGE; @@ -33,6 +32,7 @@ import static javax.servlet.http.HttpServletResponse.SC_OK; import static org.jclouds.Constants.PROPERTY_RELAX_HOSTNAME; import static org.jclouds.Constants.PROPERTY_TRUST_ALL_CERTS; import static org.jclouds.io.ByteSources.asByteSource; +import static org.jclouds.util.Closeables2.closeQuietly; import static org.jclouds.util.Strings2.toStringAndClose; import java.io.ByteArrayInputStream; diff --git a/drivers/gae/src/main/java/org/jclouds/gae/ConvertToGaeRequest.java b/drivers/gae/src/main/java/org/jclouds/gae/ConvertToGaeRequest.java index da5c41cf3b..e5ec8b5b31 100644 --- a/drivers/gae/src/main/java/org/jclouds/gae/ConvertToGaeRequest.java +++ b/drivers/gae/src/main/java/org/jclouds/gae/ConvertToGaeRequest.java @@ -34,6 +34,7 @@ import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpUtils; import org.jclouds.io.ContentMetadataCodec; import org.jclouds.io.Payload; +import org.jclouds.util.Closeables2; import com.google.appengine.api.urlfetch.FetchOptions; import com.google.appengine.api.urlfetch.HTTPHeader; @@ -42,7 +43,6 @@ import com.google.appengine.api.urlfetch.HTTPRequest; import com.google.appengine.repackaged.com.google.common.base.Throwables; import com.google.common.base.Function; import com.google.common.collect.ImmutableSet; -import com.google.common.io.Closeables; /** * @@ -113,7 +113,7 @@ public class ConvertToGaeRequest implements Function { } catch (IOException e) { Throwables.propagate(e); } finally { - Closeables.closeQuietly(input); + Closeables2.closeQuietly(input); } for (Entry header : contentMetadataCodec.toHeaders( diff --git a/drivers/jsch/src/main/java/org/jclouds/ssh/jsch/JschSshClient.java b/drivers/jsch/src/main/java/org/jclouds/ssh/jsch/JschSshClient.java index f18c06ec24..5e58b486fa 100644 --- a/drivers/jsch/src/main/java/org/jclouds/ssh/jsch/JschSshClient.java +++ b/drivers/jsch/src/main/java/org/jclouds/ssh/jsch/JschSshClient.java @@ -52,6 +52,7 @@ import org.jclouds.proxy.ProxyConfig; import org.jclouds.rest.AuthorizationException; import org.jclouds.ssh.SshClient; import org.jclouds.ssh.SshException; +import org.jclouds.util.Closeables2; import org.jclouds.util.Strings2; import com.google.common.annotations.VisibleForTesting; @@ -59,7 +60,6 @@ import com.google.common.base.Predicate; import com.google.common.base.Predicates; import com.google.common.base.Splitter; import com.google.common.base.Supplier; -import com.google.common.io.Closeables; import com.google.common.net.HostAndPort; import com.google.inject.Inject; import com.jcraft.jsch.ChannelExec; @@ -273,7 +273,7 @@ public class JschSshClient implements SshClient { try { sftp.put(is, path); } finally { - Closeables.closeQuietly(contents); + Closeables2.closeQuietly(contents); } return null; } @@ -353,9 +353,9 @@ public class JschSshClient implements SshClient { @Override public void clear() { if (inputStream != null) - Closeables.closeQuietly(inputStream); + Closeables2.closeQuietly(inputStream); if (errStream != null) - Closeables.closeQuietly(errStream); + Closeables2.closeQuietly(errStream); if (executor != null) executor.disconnect(); } diff --git a/drivers/jsch/src/test/java/org/jclouds/ssh/jsch/JschSshClientLiveTest.java b/drivers/jsch/src/test/java/org/jclouds/ssh/jsch/JschSshClientLiveTest.java index ea52e45a6b..e5f1ce26ac 100644 --- a/drivers/jsch/src/test/java/org/jclouds/ssh/jsch/JschSshClientLiveTest.java +++ b/drivers/jsch/src/test/java/org/jclouds/ssh/jsch/JschSshClientLiveTest.java @@ -41,6 +41,7 @@ import org.jclouds.io.Payloads; import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; import org.jclouds.ssh.SshClient; import org.jclouds.ssh.jsch.config.JschSshClientModule; +import org.jclouds.util.Closeables2; import org.jclouds.util.Strings2; import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; @@ -49,7 +50,6 @@ import com.google.common.base.Charsets; import com.google.common.base.Strings; import com.google.common.base.Suppliers; import com.google.common.collect.Lists; -import com.google.common.io.Closeables; import com.google.common.io.Files; import com.google.common.net.HostAndPort; import com.google.common.util.concurrent.Futures; @@ -273,7 +273,7 @@ public class JschSshClientLiveTest { assertEquals(Strings2.toStringAndClose(response.getError()), ""); assertEquals(Strings2.toStringAndClose(response.getOutput()), ""); } finally { - Closeables.closeQuietly(response); + Closeables2.closeQuietly(response); } assertEquals(response.getExitStatus().get(), Integer.valueOf(0)); } diff --git a/drivers/sshj/src/main/java/org/jclouds/sshj/SshjSshClient.java b/drivers/sshj/src/main/java/org/jclouds/sshj/SshjSshClient.java index abfb82aa35..41155175c9 100644 --- a/drivers/sshj/src/main/java/org/jclouds/sshj/SshjSshClient.java +++ b/drivers/sshj/src/main/java/org/jclouds/sshj/SshjSshClient.java @@ -64,6 +64,7 @@ import org.jclouds.logging.Logger; import org.jclouds.rest.AuthorizationException; import org.jclouds.ssh.SshClient; import org.jclouds.ssh.SshException; +import org.jclouds.util.Closeables2; import org.jclouds.util.Throwables2; import com.google.common.annotations.VisibleForTesting; @@ -73,7 +74,6 @@ import com.google.common.base.Splitter; import com.google.common.base.Supplier; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableMap; -import com.google.common.io.Closeables; import com.google.common.net.HostAndPort; import com.google.inject.Inject; @@ -475,7 +475,7 @@ public class SshjSshClient implements SshClient { if (session != null) session.close(); if (sshClientConnection != null) - Closeables.closeQuietly(sshClientConnection); + Closeables2.closeQuietly(sshClientConnection); } @Override @@ -505,8 +505,8 @@ public class SshjSshClient implements SshClient { @Override public void clear() { - Closeables.closeQuietly(output); - Closeables.closeQuietly(session); + Closeables2.closeQuietly(output); + Closeables2.closeQuietly(session); } @Override diff --git a/drivers/sshj/src/test/java/org/jclouds/sshj/SshjSshClientLiveTest.java b/drivers/sshj/src/test/java/org/jclouds/sshj/SshjSshClientLiveTest.java index c997187772..1aba367012 100644 --- a/drivers/sshj/src/test/java/org/jclouds/sshj/SshjSshClientLiveTest.java +++ b/drivers/sshj/src/test/java/org/jclouds/sshj/SshjSshClientLiveTest.java @@ -35,6 +35,7 @@ import org.jclouds.io.Payloads; import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; import org.jclouds.ssh.SshClient; import org.jclouds.sshj.config.SshjSshClientModule; +import org.jclouds.util.Closeables2; import org.jclouds.util.Strings2; import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; @@ -42,7 +43,6 @@ import org.testng.annotations.Test; import com.google.common.base.Charsets; import com.google.common.base.Strings; import com.google.common.base.Suppliers; -import com.google.common.io.Closeables; import com.google.common.io.Files; import com.google.common.net.HostAndPort; import com.google.inject.Guice; @@ -182,7 +182,7 @@ public class SshjSshClientLiveTest { assertEquals(Strings2.toStringAndClose(response.getError()), ""); assertEquals(Strings2.toStringAndClose(response.getOutput()), ""); } finally { - Closeables.closeQuietly(response); + Closeables2.closeQuietly(response); } assertEquals(response.getExitStatus().get(), Integer.valueOf(0)); } diff --git a/loadbalancer/src/main/java/org/jclouds/loadbalancer/internal/LoadBalancerServiceContextImpl.java b/loadbalancer/src/main/java/org/jclouds/loadbalancer/internal/LoadBalancerServiceContextImpl.java index f5a7f85ed3..dbbc036b22 100644 --- a/loadbalancer/src/main/java/org/jclouds/loadbalancer/internal/LoadBalancerServiceContextImpl.java +++ b/loadbalancer/src/main/java/org/jclouds/loadbalancer/internal/LoadBalancerServiceContextImpl.java @@ -27,8 +27,8 @@ import org.jclouds.loadbalancer.LoadBalancerService; import org.jclouds.loadbalancer.LoadBalancerServiceContext; import org.jclouds.location.Provider; import org.jclouds.rest.Utils; +import org.jclouds.util.Closeables2; -import com.google.common.io.Closeables; import com.google.common.reflect.TypeToken; /** @@ -59,7 +59,7 @@ public class LoadBalancerServiceContextImpl extends BaseView implements LoadBala @Override public void close() { - Closeables.closeQuietly(delegate()); + Closeables2.closeQuietly(delegate()); } public int hashCode() { diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/handlers/GleSYSErrorHandler.java b/providers/glesys/src/main/java/org/jclouds/glesys/handlers/GleSYSErrorHandler.java index 218f481ab5..3ee981d9ea 100644 --- a/providers/glesys/src/main/java/org/jclouds/glesys/handlers/GleSYSErrorHandler.java +++ b/providers/glesys/src/main/java/org/jclouds/glesys/handlers/GleSYSErrorHandler.java @@ -26,10 +26,10 @@ import org.jclouds.http.HttpResponse; import org.jclouds.http.HttpResponseException; import org.jclouds.rest.AuthorizationException; import org.jclouds.rest.ResourceNotFoundException; +import org.jclouds.util.Closeables2; import org.jclouds.util.Strings2; import com.google.common.base.Throwables; -import com.google.common.io.Closeables; /** * This will parse and set an appropriate exception on the command object. @@ -72,7 +72,7 @@ public class GleSYSErrorHandler implements HttpErrorHandler { break; } } finally { - Closeables.closeQuietly(response.getPayload()); + Closeables2.closeQuietly(response.getPayload()); command.setException(exception); } } diff --git a/providers/glesys/src/test/java/org/jclouds/glesys/compute/GleSYSExperimentLiveTest.java b/providers/glesys/src/test/java/org/jclouds/glesys/compute/GleSYSExperimentLiveTest.java index e0e683c2b7..f3386dd6f6 100644 --- a/providers/glesys/src/test/java/org/jclouds/glesys/compute/GleSYSExperimentLiveTest.java +++ b/providers/glesys/src/test/java/org/jclouds/glesys/compute/GleSYSExperimentLiveTest.java @@ -22,10 +22,9 @@ import org.jclouds.ContextBuilder; import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest; import org.jclouds.glesys.GleSYSProviderMetadata; +import org.jclouds.util.Closeables2; import org.testng.annotations.Test; -import com.google.common.io.Closeables; - /** * * @author Adrian Cole @@ -50,7 +49,7 @@ public class GleSYSExperimentLiveTest extends BaseComputeServiceContextLiveTest assertEquals(context.getComputeService().listAssignableLocations().size(), 4); } finally { - Closeables.closeQuietly(context); + Closeables2.closeQuietly(context); } } diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/handlers/SoftLayerErrorHandler.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/handlers/SoftLayerErrorHandler.java index 30a8bf4db4..d665baf510 100644 --- a/providers/softlayer/src/main/java/org/jclouds/softlayer/handlers/SoftLayerErrorHandler.java +++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/handlers/SoftLayerErrorHandler.java @@ -27,10 +27,10 @@ import org.jclouds.http.HttpResponseException; import org.jclouds.rest.AuthorizationException; import org.jclouds.rest.ResourceNotFoundException; import org.jclouds.softlayer.exceptions.SoftLayerOrderItemDuplicateException; +import org.jclouds.util.Closeables2; import org.jclouds.util.Strings2; import com.google.common.base.Throwables; -import com.google.common.io.Closeables; /** * This will parse and set an appropriate exception on the command object. @@ -71,7 +71,7 @@ public class SoftLayerErrorHandler implements HttpErrorHandler { } } } finally { - Closeables.closeQuietly(response.getPayload()); + Closeables2.closeQuietly(response.getPayload()); command.setException(exception); } }