cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject [35/50] [abbrv] git commit: updated refs/heads/disk-cache to 99d67cb
Date Mon, 02 Sep 2013 20:05:21 GMT
CLOUDSTACK-3748: AddS3Cmd NPE.


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

Branch: refs/heads/disk-cache
Commit: a2f1d233787b9182a1ef4ae45eee3bfc0f4d6eb5
Parents: 7a2aaf9
Author: Min Chen <min.chen@citrix.com>
Authored: Thu Aug 1 18:02:42 2013 -0700
Committer: Min Chen <min.chen@citrix.com>
Committed: Fri Aug 2 13:53:43 2013 -0700

----------------------------------------------------------------------
 .../api/command/admin/storage/AddS3Cmd.java     | 28 +++++++++++++-------
 1 file changed, 18 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a2f1d233/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java
index 3ad84fd..70cde78 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java
@@ -91,8 +91,8 @@ public final class AddS3Cmd extends BaseCmd {
 
     @Override
     public void execute() throws ResourceUnavailableException, InsufficientCapacityException,
-            ServerApiException, ConcurrentOperationException, ResourceAllocationException,
-            NetworkRuleConflictException {
+    ServerApiException, ConcurrentOperationException, ResourceAllocationException,
+    NetworkRuleConflictException {
 
         AddImageStoreCmd cmd = new AddImageStoreCmd();
         cmd.setProviderName("S3");
@@ -101,19 +101,27 @@ public final class AddS3Cmd extends BaseCmd {
         details.put(ApiConstants.S3_SECRET_KEY, this.getSecretKey());
         details.put(ApiConstants.S3_END_POINT, this.getEndPoint());
         details.put(ApiConstants.S3_BUCKET_NAME, this.getBucketName());
-        details.put(ApiConstants.S3_HTTPS_FLAG, this.getHttpsFlag().toString());
-        details.put(ApiConstants.S3_CONNECTION_TIMEOUT, this.getConnectionTimeout().toString());
-        details.put(ApiConstants.S3_MAX_ERROR_RETRY, this.getMaxErrorRetry().toString());
-        details.put(ApiConstants.S3_SOCKET_TIMEOUT, this.getSocketTimeout().toString());
+        if (this.getHttpsFlag() != null) {
+            details.put(ApiConstants.S3_HTTPS_FLAG, this.getHttpsFlag().toString());
+        }
+        if (this.getConnectionTimeout() != null) {
+            details.put(ApiConstants.S3_CONNECTION_TIMEOUT, this.getConnectionTimeout().toString());
+        }
+        if (this.getMaxErrorRetry() != null) {
+            details.put(ApiConstants.S3_MAX_ERROR_RETRY, this.getMaxErrorRetry().toString());
+        }
+        if (this.getSocketTimeout() != null) {
+            details.put(ApiConstants.S3_SOCKET_TIMEOUT, this.getSocketTimeout().toString());
+        }
 
         try{
             ImageStore result = _storageService.discoverImageStore(cmd);
             ImageStoreResponse storeResponse = null;
             if (result != null ) {
-                    storeResponse = _responseGenerator.createImageStoreResponse(result);
-                    storeResponse.setResponseName(getCommandName());
-                    storeResponse.setObjectName("secondarystorage");
-                    this.setResponseObject(storeResponse);
+                storeResponse = _responseGenerator.createImageStoreResponse(result);
+                storeResponse.setResponseName(getCommandName());
+                storeResponse.setObjectName("secondarystorage");
+                this.setResponseObject(storeResponse);
             } else {
                 throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add
secondary storage");
             }


Mime
View raw message