You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ga...@apache.org on 2018/04/19 15:43:52 UTC

[1/2] jclouds git commit: Avoid double brace initialization

Repository: jclouds
Updated Branches:
  refs/heads/master 3d188324d -> 316bce058


Avoid double brace initialization

These hold an implicit this reference.  Found via error-prone 2.3.0.


Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/316bce05
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/316bce05
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/316bce05

Branch: refs/heads/master
Commit: 316bce05872c7a7b68e9ece7b880f9ffe28c27d8
Parents: 46a9f57
Author: Andrew Gaul <ga...@apache.org>
Authored: Thu Apr 19 08:41:53 2018 -0700
Committer: Andrew Gaul <ga...@apache.org>
Committed: Thu Apr 19 08:43:46 2018 -0700

----------------------------------------------------------------------
 ...GetProvisioningStateResponseHandlerTest.java | 119 +++++++++----------
 1 file changed, 59 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/316bce05/providers/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/state/GetProvisioningStateResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/providers/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/state/GetProvisioningStateResponseHandlerTest.java b/providers/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/state/GetProvisioningStateResponseHandlerTest.java
index 3bd2755..cba8212 100644
--- a/providers/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/state/GetProvisioningStateResponseHandlerTest.java
+++ b/providers/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/state/GetProvisioningStateResponseHandlerTest.java
@@ -30,6 +30,65 @@ import org.testng.annotations.Test;
 @Test(groups = "unit", testName = "GetProvisioningStateResponseHandlerTest")
 public class GetProvisioningStateResponseHandlerTest extends BaseResponseHandlerTest<ProvisioningState> {
 
+   private final Map<ProvisioningState, String> sampleResponses = new LinkedHashMap<ProvisioningState, String>();
+
+   GetProvisioningStateResponseHandlerTest() {
+      sampleResponses.put(ProvisioningState.INACTIVE,
+              "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">\n"
+              + "   <soapenv:Header/>\n"
+              + "   <soapenv:Body>\n"
+              + "      <ws:getDataCenterStateResponse>\n"
+              + "         <return>INACTIVE</return>\n"
+              + "      </ws:getDataCenterStateResponse>\n"
+              + "   </soapenv:Body>\n"
+              + "</soapenv:Envelope>");
+      sampleResponses.put(ProvisioningState.INPROCESS,
+              "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">\n"
+              + "   <soapenv:Header/>\n"
+              + "   <soapenv:Body>\n"
+              + "      <ws:getDataCenterStateResponse>\n"
+              + "         <return>INPROCESS</return>\n"
+              + "      </ws:getDataCenterStateResponse>\n"
+              + "   </soapenv:Body>\n"
+              + "</soapenv:Envelope>");
+      sampleResponses.put(ProvisioningState.AVAILABLE,
+              "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">\n"
+              + "   <soapenv:Header/>\n"
+              + "   <soapenv:Body>\n"
+              + "      <ws:getDataCenterStateResponse>\n"
+              + "         <return>AVAILABLE</return>\n"
+              + "      </ws:getDataCenterStateResponse>\n"
+              + "   </soapenv:Body>\n"
+              + "</soapenv:Envelope>");
+      sampleResponses.put(ProvisioningState.DELETED,
+              "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">\n"
+              + "   <soapenv:Header/>\n"
+              + "   <soapenv:Body>\n"
+              + "      <ws:getDataCenterStateResponse>\n"
+              + "         <return>DELETED</return>\n"
+              + "      </ws:getDataCenterStateResponse>\n"
+              + "   </soapenv:Body>\n"
+              + "</soapenv:Envelope>");
+      sampleResponses.put(ProvisioningState.ERROR,
+              "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">\n"
+              + "   <soapenv:Header/>\n"
+              + "   <soapenv:Body>\n"
+              + "      <ws:getDataCenterStateResponse>\n"
+              + "         <return>ERROR</return>\n"
+              + "      </ws:getDataCenterStateResponse>\n"
+              + "   </soapenv:Body>\n"
+              + "</soapenv:Envelope>");
+      sampleResponses.put(ProvisioningState.UNRECOGNIZED,
+              "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">\n"
+              + "   <soapenv:Header/>\n"
+              + "   <soapenv:Body>\n"
+              + "      <ws:getDataCenterStateResponse>\n"
+              + "         <return>MEH</return>\n"
+              + "      </ws:getDataCenterStateResponse>\n"
+              + "   </soapenv:Body>\n"
+              + "</soapenv:Envelope>");
+   }
+
    @Override
    protected ParseSax<ProvisioningState> createParser() {
       return factory.create(injector.getInstance(GetProvisioningStateResponseHandler.class));
@@ -47,64 +106,4 @@ public class GetProvisioningStateResponseHandlerTest extends BaseResponseHandler
       }
 
    }
-
-   private final Map<ProvisioningState, String> sampleResponses = new LinkedHashMap<ProvisioningState, String>() {
-      {
-         put(ProvisioningState.INACTIVE,
-                 "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">\n"
-                 + "   <soapenv:Header/>\n"
-                 + "   <soapenv:Body>\n"
-                 + "      <ws:getDataCenterStateResponse>\n"
-                 + "         <return>INACTIVE</return>\n"
-                 + "      </ws:getDataCenterStateResponse>\n"
-                 + "   </soapenv:Body>\n"
-                 + "</soapenv:Envelope>");
-         put(ProvisioningState.INPROCESS,
-                 "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">\n"
-                 + "   <soapenv:Header/>\n"
-                 + "   <soapenv:Body>\n"
-                 + "      <ws:getDataCenterStateResponse>\n"
-                 + "         <return>INPROCESS</return>\n"
-                 + "      </ws:getDataCenterStateResponse>\n"
-                 + "   </soapenv:Body>\n"
-                 + "</soapenv:Envelope>");
-         put(ProvisioningState.AVAILABLE,
-                 "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">\n"
-                 + "   <soapenv:Header/>\n"
-                 + "   <soapenv:Body>\n"
-                 + "      <ws:getDataCenterStateResponse>\n"
-                 + "         <return>AVAILABLE</return>\n"
-                 + "      </ws:getDataCenterStateResponse>\n"
-                 + "   </soapenv:Body>\n"
-                 + "</soapenv:Envelope>");
-         put(ProvisioningState.DELETED,
-                 "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">\n"
-                 + "   <soapenv:Header/>\n"
-                 + "   <soapenv:Body>\n"
-                 + "      <ws:getDataCenterStateResponse>\n"
-                 + "         <return>DELETED</return>\n"
-                 + "      </ws:getDataCenterStateResponse>\n"
-                 + "   </soapenv:Body>\n"
-                 + "</soapenv:Envelope>");
-         put(ProvisioningState.ERROR,
-                 "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">\n"
-                 + "   <soapenv:Header/>\n"
-                 + "   <soapenv:Body>\n"
-                 + "      <ws:getDataCenterStateResponse>\n"
-                 + "         <return>ERROR</return>\n"
-                 + "      </ws:getDataCenterStateResponse>\n"
-                 + "   </soapenv:Body>\n"
-                 + "</soapenv:Envelope>");
-         put(ProvisioningState.UNRECOGNIZED,
-                 "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">\n"
-                 + "   <soapenv:Header/>\n"
-                 + "   <soapenv:Body>\n"
-                 + "      <ws:getDataCenterStateResponse>\n"
-                 + "         <return>MEH</return>\n"
-                 + "      </ws:getDataCenterStateResponse>\n"
-                 + "   </soapenv:Body>\n"
-                 + "</soapenv:Envelope>");
-      }
-   };
-
 }


[2/2] jclouds git commit: Fix some orphaned format strings

Posted by ga...@apache.org.
Fix some orphaned format strings

These lack values to format with.  Found via error-prone 2.3.0.


Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/46a9f574
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/46a9f574
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/46a9f574

Branch: refs/heads/master
Commit: 46a9f574e20183672b9ef5cedbb79e5d0391a12c
Parents: 3d18832
Author: Andrew Gaul <ga...@apache.org>
Authored: Thu Apr 19 08:41:16 2018 -0700
Committer: Andrew Gaul <ga...@apache.org>
Committed: Thu Apr 19 08:43:46 2018 -0700

----------------------------------------------------------------------
 .../validators/internal/FilesystemBlobKeyValidatorImpl.java      | 2 +-
 .../internal/FilesystemContainerNameValidatorImpl.java           | 2 +-
 .../src/test/java/org/jclouds/ssh/jsch/JschSshClientTest.java    | 4 ++--
 .../sshj/src/test/java/org/jclouds/sshj/SshjSshClientTest.java   | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/46a9f574/apis/filesystem/src/main/java/org/jclouds/filesystem/predicates/validators/internal/FilesystemBlobKeyValidatorImpl.java
----------------------------------------------------------------------
diff --git a/apis/filesystem/src/main/java/org/jclouds/filesystem/predicates/validators/internal/FilesystemBlobKeyValidatorImpl.java b/apis/filesystem/src/main/java/org/jclouds/filesystem/predicates/validators/internal/FilesystemBlobKeyValidatorImpl.java
index 9855e52..25e4fda 100644
--- a/apis/filesystem/src/main/java/org/jclouds/filesystem/predicates/validators/internal/FilesystemBlobKeyValidatorImpl.java
+++ b/apis/filesystem/src/main/java/org/jclouds/filesystem/predicates/validators/internal/FilesystemBlobKeyValidatorImpl.java
@@ -37,7 +37,7 @@ public class FilesystemBlobKeyValidatorImpl extends FilesystemBlobKeyValidator {
 
         //blobkey cannot start with / (or \ in Windows) character
         if (name.startsWith("\\") || name.startsWith("/"))
-            throw new IllegalArgumentException("Blob key '%s' cannot start with \\ or /");
+            throw new IllegalArgumentException("Blob key '" + name + "' cannot start with \\ or /");
     }
 
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/46a9f574/apis/filesystem/src/main/java/org/jclouds/filesystem/predicates/validators/internal/FilesystemContainerNameValidatorImpl.java
----------------------------------------------------------------------
diff --git a/apis/filesystem/src/main/java/org/jclouds/filesystem/predicates/validators/internal/FilesystemContainerNameValidatorImpl.java b/apis/filesystem/src/main/java/org/jclouds/filesystem/predicates/validators/internal/FilesystemContainerNameValidatorImpl.java
index 0d48ec9..c18835a 100644
--- a/apis/filesystem/src/main/java/org/jclouds/filesystem/predicates/validators/internal/FilesystemContainerNameValidatorImpl.java
+++ b/apis/filesystem/src/main/java/org/jclouds/filesystem/predicates/validators/internal/FilesystemContainerNameValidatorImpl.java
@@ -37,7 +37,7 @@ public class FilesystemContainerNameValidatorImpl extends FilesystemContainerNam
 
         //container name cannot contains / (or \ in Windows) character
         if (name.contains("\\") || name.contains("/"))
-            throw new IllegalArgumentException("Container name '%s' cannot contain \\ or /");
+            throw new IllegalArgumentException("Container name '" + name + "' cannot contain \\ or /");
     }
 
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/46a9f574/drivers/jsch/src/test/java/org/jclouds/ssh/jsch/JschSshClientTest.java
----------------------------------------------------------------------
diff --git a/drivers/jsch/src/test/java/org/jclouds/ssh/jsch/JschSshClientTest.java b/drivers/jsch/src/test/java/org/jclouds/ssh/jsch/JschSshClientTest.java
index 8274c27..33f069e 100644
--- a/drivers/jsch/src/test/java/org/jclouds/ssh/jsch/JschSshClientTest.java
+++ b/drivers/jsch/src/test/java/org/jclouds/ssh/jsch/JschSshClientTest.java
@@ -79,8 +79,8 @@ public class JschSshClientTest {
    public void testExceptionClassesRetry() {
       assert ssh.shouldRetry(new JSchException("io error", new IOException("socket closed")));
       assert ssh.shouldRetry(new JSchException("connect error", new ConnectException("problem")));
-      assert ssh.shouldRetry(new IOException("channel %s is not open", new NullPointerException()));
-      assert ssh.shouldRetry(new IOException("channel %s is not open", new NullPointerException(null)));
+      assert ssh.shouldRetry(new IOException("channel is not open", new NullPointerException()));
+      assert ssh.shouldRetry(new IOException("channel is not open", new NullPointerException(null)));
    }
 
    public void testOnlyRetryAuthWhenSet() throws UnknownHostException {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/46a9f574/drivers/sshj/src/test/java/org/jclouds/sshj/SshjSshClientTest.java
----------------------------------------------------------------------
diff --git a/drivers/sshj/src/test/java/org/jclouds/sshj/SshjSshClientTest.java b/drivers/sshj/src/test/java/org/jclouds/sshj/SshjSshClientTest.java
index 1d2e826..1726d28 100644
--- a/drivers/sshj/src/test/java/org/jclouds/sshj/SshjSshClientTest.java
+++ b/drivers/sshj/src/test/java/org/jclouds/sshj/SshjSshClientTest.java
@@ -109,7 +109,7 @@ public class SshjSshClientTest {
       assert ssh.shouldRetry(new TransportException("socket closed"));
       assert ssh.shouldRetry(new ConnectionException("problem"));
       assert ssh.shouldRetry(new ConnectException("Connection refused"));
-      assert !ssh.shouldRetry(new IOException("channel %s is not open", new NullPointerException()));
+      assert !ssh.shouldRetry(new IOException("channel is not open", new NullPointerException()));
    }
 
    public void testOnlyRetryAuthWhenSet() {