Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8751210AC2 for ; Mon, 2 Sep 2013 20:05:20 +0000 (UTC) Received: (qmail 117 invoked by uid 500); 2 Sep 2013 20:05:00 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 99653 invoked by uid 500); 2 Sep 2013 20:04:50 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 99316 invoked by uid 99); 2 Sep 2013 20:04:49 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Sep 2013 20:04:49 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 358168BBFBE; Mon, 2 Sep 2013 20:04:49 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: widodh@apache.org To: commits@cloudstack.apache.org Date: Mon, 02 Sep 2013 20:05:21 -0000 Message-Id: <1f5667e2e4634940ab5fe61d851521f6@git.apache.org> In-Reply-To: <50cd0f4b28224616847f6afdbcbb1698@git.apache.org> References: <50cd0f4b28224616847f6afdbcbb1698@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [35/50] [abbrv] git commit: updated refs/heads/disk-cache to 99d67cb 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 Authored: Thu Aug 1 18:02:42 2013 -0700 Committer: Min Chen 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"); }