You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2013/08/02 22:42:29 UTC
[1/2] git commit: updated refs/heads/4.2 to ad20a9b
Updated Branches:
refs/heads/4.2 8fe4c240b -> ad20a9b6f
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/ad20a9b6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ad20a9b6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ad20a9b6
Branch: refs/heads/4.2
Commit: ad20a9b6fa09d3595c2dec8c213cb3fee35d1973
Parents: 838c972
Author: Min Chen <mi...@citrix.com>
Authored: Fri Aug 2 11:51:56 2013 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Fri Aug 2 13:42:19 2013 -0700
----------------------------------------------------------------------
.../command/admin/storage/AddImageStoreCmd.java | 36 ++++++++--------
.../api/command/admin/storage/AddS3Cmd.java | 43 +++++++++++---------
2 files changed, 42 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ad20a9b6/api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java
index 7e44098..1552e05 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java
@@ -60,7 +60,7 @@ public class AddImageStoreCmd extends BaseCmd {
@Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="the details for the image store. Example: details[0].key=accesskey&details[0].value=s389ddssaa&details[1].key=secretkey&details[1].value=8dshfsss")
- private Map<String, String> details;
+ private Map details;
@@ -81,19 +81,19 @@ public class AddImageStoreCmd extends BaseCmd {
return zoneId;
}
- public Map<String, String> getDetails() {
- Map<String, String> detailsMap = null;
- if (details != null && !details.isEmpty()) {
- detailsMap = new HashMap<String, String>();
- Collection<?> props = details.values();
- Iterator<?> iter = props.iterator();
- while (iter.hasNext()) {
- HashMap<String, String> detail = (HashMap<String, String>) iter.next();
- String key = detail.get("key");
- String value = detail.get("value");
- detailsMap.put(key, value);
- }
- }
+ public Map<String, String> getDetails() {
+ Map<String, String> detailsMap = null;
+ if (details != null && !details.isEmpty()) {
+ detailsMap = new HashMap<String, String>();
+ Collection<?> props = details.values();
+ Iterator<?> iter = props.iterator();
+ while (iter.hasNext()) {
+ HashMap<String, String> detail = (HashMap<String, String>) iter.next();
+ String key = detail.get("key");
+ String value = detail.get("value");
+ detailsMap.put(key, value);
+ }
+ }
return detailsMap;
}
@@ -139,10 +139,10 @@ public class AddImageStoreCmd extends BaseCmd {
ImageStore result = _storageService.discoverImageStore(this);
ImageStoreResponse storeResponse = null;
if (result != null ) {
- storeResponse = _responseGenerator.createImageStoreResponse(result);
- storeResponse.setResponseName(getCommandName());
- storeResponse.setObjectName("imagestore");
- this.setResponseObject(storeResponse);
+ storeResponse = _responseGenerator.createImageStoreResponse(result);
+ storeResponse.setResponseName(getCommandName());
+ storeResponse.setObjectName("imagestore");
+ this.setResponseObject(storeResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ad20a9b6/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 70cde78..0af1a85 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
@@ -94,25 +94,30 @@ public final class AddS3Cmd extends BaseCmd {
ServerApiException, ConcurrentOperationException, ResourceAllocationException,
NetworkRuleConflictException {
- AddImageStoreCmd cmd = new AddImageStoreCmd();
+ AddImageStoreCmd cmd = new AddImageStoreCmd() {
+ @Override
+ public Map<String, String> getDetails() {
+ Map<String, String> dm = new HashMap<String, String>();
+ dm.put(ApiConstants.S3_ACCESS_KEY, getAccessKey());
+ dm.put(ApiConstants.S3_SECRET_KEY, getSecretKey());
+ dm.put(ApiConstants.S3_END_POINT, getEndPoint());
+ dm.put(ApiConstants.S3_BUCKET_NAME, getBucketName());
+ if (getHttpsFlag() != null) {
+ dm.put(ApiConstants.S3_HTTPS_FLAG, getHttpsFlag().toString());
+ }
+ if (getConnectionTimeout() != null) {
+ dm.put(ApiConstants.S3_CONNECTION_TIMEOUT, getConnectionTimeout().toString());
+ }
+ if (getMaxErrorRetry() != null) {
+ dm.put(ApiConstants.S3_MAX_ERROR_RETRY, getMaxErrorRetry().toString());
+ }
+ if (getSocketTimeout() != null) {
+ dm.put(ApiConstants.S3_SOCKET_TIMEOUT, getSocketTimeout().toString());
+ }
+ return dm;
+ }
+ };
cmd.setProviderName("S3");
- Map<String, String> details = new HashMap<String, String>();
- details.put(ApiConstants.S3_ACCESS_KEY, this.getAccessKey());
- details.put(ApiConstants.S3_SECRET_KEY, this.getSecretKey());
- details.put(ApiConstants.S3_END_POINT, this.getEndPoint());
- details.put(ApiConstants.S3_BUCKET_NAME, this.getBucketName());
- 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);
@@ -123,7 +128,7 @@ public final class AddS3Cmd extends BaseCmd {
storeResponse.setObjectName("secondarystorage");
this.setResponseObject(storeResponse);
} else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add S3 secondary storage");
}
} catch (DiscoveryException ex) {
s_logger.warn("Exception: ", ex);
[2/2] git commit: updated refs/heads/4.2 to ad20a9b
Posted by mc...@apache.org.
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/838c972d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/838c972d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/838c972d
Branch: refs/heads/4.2
Commit: 838c972da06ed2c55ba03a2533fe8b4b9cfddbbf
Parents: 8fe4c24
Author: Min Chen <mi...@citrix.com>
Authored: Thu Aug 1 18:02:42 2013 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Fri Aug 2 13:42:19 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/838c972d/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");
}