You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ml...@apache.org on 2013/01/16 21:59:57 UTC

[40/50] git commit: Consolidate RuntimeCloudException and CloudRuntimeException into one class CloudRuntimeException, and removed RuntimeCloudException to avoid confusion.

Consolidate RuntimeCloudException and CloudRuntimeException into one
class CloudRuntimeException, and removed RuntimeCloudException to avoid
confusion.

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

Branch: refs/heads/resizevolume
Commit: 8608925216e87691bc49fa4417d3446c2b81a5a7
Parents: f6a8b45
Author: Min Chen <mi...@citrix.com>
Authored: Tue Jan 15 18:07:08 2013 -0800
Committer: Min Chen <mi...@citrix.com>
Committed: Tue Jan 15 18:07:08 2013 -0800

----------------------------------------------------------------------
 .../exception/CloudAuthenticationException.java    |    4 +-
 .../cloud/exception/CloudExecutionException.java   |    4 +-
 .../apache/cloudstack/api/ServerApiException.java  |    4 +-
 .../cloud/simulator/SimulatorRuntimeException.java |    4 +-
 server/src/com/cloud/async/AsyncCommandQueued.java |    4 +-
 .../utils/exception/CloudRuntimeException.java     |   48 ++++++++-
 .../HypervisorVersionChangedException.java         |    4 +-
 .../utils/exception/RuntimeCloudException.java     |   75 ---------------
 8 files changed, 55 insertions(+), 92 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/86089252/api/src/com/cloud/exception/CloudAuthenticationException.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/exception/CloudAuthenticationException.java b/api/src/com/cloud/exception/CloudAuthenticationException.java
index 2bba79b..0bf114c 100644
--- a/api/src/com/cloud/exception/CloudAuthenticationException.java
+++ b/api/src/com/cloud/exception/CloudAuthenticationException.java
@@ -17,9 +17,9 @@
 package com.cloud.exception;
 
 import com.cloud.utils.SerialVersionUID;
-import com.cloud.utils.exception.RuntimeCloudException;
+import com.cloud.utils.exception.CloudRuntimeException;
 
-public class CloudAuthenticationException extends RuntimeCloudException {
+public class CloudAuthenticationException extends CloudRuntimeException {
     private static final long serialVersionUID = SerialVersionUID.CloudAuthenticationException;
 
     public CloudAuthenticationException(String message) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/86089252/api/src/com/cloud/exception/CloudExecutionException.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/exception/CloudExecutionException.java b/api/src/com/cloud/exception/CloudExecutionException.java
index d8d70f8..c19fc45 100755
--- a/api/src/com/cloud/exception/CloudExecutionException.java
+++ b/api/src/com/cloud/exception/CloudExecutionException.java
@@ -17,14 +17,14 @@
 package com.cloud.exception;
 
 import java.util.HashMap;
-import com.cloud.utils.exception.RuntimeCloudException;
 
+import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.SerialVersionUID;
 
 /**
  *
  */
-public class CloudExecutionException extends RuntimeCloudException {
+public class CloudExecutionException extends CloudRuntimeException {
     private final static long serialVersionUID = SerialVersionUID.CloudExecutionException;
 
     private final ErrorCode code;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/86089252/api/src/org/apache/cloudstack/api/ServerApiException.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ServerApiException.java b/api/src/org/apache/cloudstack/api/ServerApiException.java
index 70fd34e..1f57b74 100644
--- a/api/src/org/apache/cloudstack/api/ServerApiException.java
+++ b/api/src/org/apache/cloudstack/api/ServerApiException.java
@@ -15,10 +15,10 @@
 // specific language governing permissions and limitations
 // under the License.
 package org.apache.cloudstack.api;
-import com.cloud.utils.exception.RuntimeCloudException;
+import com.cloud.utils.exception.CloudRuntimeException;
 
 @SuppressWarnings("serial")
-public class ServerApiException extends RuntimeCloudException {
+public class ServerApiException extends CloudRuntimeException {
     private int _errorCode;
     private String _description;
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/86089252/plugins/hypervisors/simulator/src/com/cloud/simulator/SimulatorRuntimeException.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/SimulatorRuntimeException.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/SimulatorRuntimeException.java
index 9891bc8..9f24bbd 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/simulator/SimulatorRuntimeException.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/SimulatorRuntimeException.java
@@ -18,12 +18,12 @@
 package com.cloud.simulator;
 
 import com.cloud.utils.SerialVersionUID;
-import com.cloud.utils.exception.RuntimeCloudException;
+import com.cloud.utils.exception.CloudRuntimeException;
 
 /**
  * wrap exceptions that you know there's no point in dealing with.
  */
-public class SimulatorRuntimeException extends RuntimeCloudException {
+public class SimulatorRuntimeException extends CloudRuntimeException {
 
     private static final long serialVersionUID = SerialVersionUID.CloudRuntimeException;
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/86089252/server/src/com/cloud/async/AsyncCommandQueued.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/async/AsyncCommandQueued.java b/server/src/com/cloud/async/AsyncCommandQueued.java
index 200b40e..f01c214 100644
--- a/server/src/com/cloud/async/AsyncCommandQueued.java
+++ b/server/src/com/cloud/async/AsyncCommandQueued.java
@@ -17,9 +17,9 @@
 package com.cloud.async;
 
 import com.cloud.utils.SerialVersionUID;
-import com.cloud.utils.exception.RuntimeCloudException;
+import com.cloud.utils.exception.CloudRuntimeException;
 
-public class AsyncCommandQueued extends RuntimeCloudException {
+public class AsyncCommandQueued extends CloudRuntimeException {
     private static final long serialVersionUID = SerialVersionUID.AsyncCommandQueued;
 
     private SyncQueueVO _queue = null;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/86089252/utils/src/com/cloud/utils/exception/CloudRuntimeException.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/exception/CloudRuntimeException.java b/utils/src/com/cloud/utils/exception/CloudRuntimeException.java
index 7807594..3862e22 100755
--- a/utils/src/com/cloud/utils/exception/CloudRuntimeException.java
+++ b/utils/src/com/cloud/utils/exception/CloudRuntimeException.java
@@ -16,24 +16,62 @@
 // under the License.
 package com.cloud.utils.exception;
 
+import java.util.ArrayList;
+
+import com.cloud.utils.AnnotationHelper;
 import com.cloud.utils.SerialVersionUID;
 
 /**
  * wrap exceptions that you know there's no point in dealing with.
  */
-public class CloudRuntimeException extends RuntimeCloudException {
+public class CloudRuntimeException extends RuntimeException {
 
     private static final long serialVersionUID = SerialVersionUID.CloudRuntimeException;
-    
+
+    // This holds a list of uuids and their names. Add uuid:fieldname pairs
+    protected ArrayList<String> idList = new ArrayList<String>();
+
+    protected int csErrorCode;
+
+
     public CloudRuntimeException(String message) {
         super(message);
+        setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
     }
-    
+
     public CloudRuntimeException(String message, Throwable th) {
         super(message, th);
+        setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
     }
-    
-    protected CloudRuntimeException() {
+
+    public CloudRuntimeException() {
         super();
+        setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
+    }
+
+    public void addProxyObject(String uuid) {
+        idList.add(uuid);
+        return;
+    }
+
+    public void addProxyObject(Object voObj, Long id, String idFieldName) {
+        // Get the VO object's table name.
+        String tablename = AnnotationHelper.getTableName(voObj);
+        if (tablename != null) {
+            addProxyObject(tablename, id, idFieldName);
+        }
+        return;
+    }
+
+    public ArrayList<String> getIdProxyList() {
+        return idList;
+    }
+
+    public void setCSErrorCode(int cserrcode) {
+        this.csErrorCode = cserrcode;
+    }
+
+    public int getCSErrorCode() {
+        return this.csErrorCode;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/86089252/utils/src/com/cloud/utils/exception/HypervisorVersionChangedException.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/exception/HypervisorVersionChangedException.java b/utils/src/com/cloud/utils/exception/HypervisorVersionChangedException.java
index 4f637cb..2c0c1cc 100755
--- a/utils/src/com/cloud/utils/exception/HypervisorVersionChangedException.java
+++ b/utils/src/com/cloud/utils/exception/HypervisorVersionChangedException.java
@@ -18,10 +18,10 @@ package com.cloud.utils.exception;
 
 import com.cloud.utils.SerialVersionUID;
 
-public class HypervisorVersionChangedException extends RuntimeCloudException {
+public class HypervisorVersionChangedException extends CloudRuntimeException {
 
     private static final long serialVersionUID = SerialVersionUID.CloudRuntimeException;
-    
+
     public HypervisorVersionChangedException(String message) {
         super(message);
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/86089252/utils/src/com/cloud/utils/exception/RuntimeCloudException.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/exception/RuntimeCloudException.java b/utils/src/com/cloud/utils/exception/RuntimeCloudException.java
deleted file mode 100644
index 5222980..0000000
--- a/utils/src/com/cloud/utils/exception/RuntimeCloudException.java
+++ /dev/null
@@ -1,75 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// the License.  You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.utils.exception;
-
-import com.cloud.utils.AnnotationHelper;
-import java.util.ArrayList;
-
-/**
- * by the API response serializer. Any exceptions that are thrown by
- * class, which extends Exception instead of RuntimeException like this
- * class does.
- */
-
-public class RuntimeCloudException extends RuntimeException {
-
-	// This holds a list of uuids and their names. Add uuid:fieldname pairs
-	protected ArrayList<String> idList = new ArrayList<String>();
-
-	protected int csErrorCode;
-
-	public void addProxyObject(String uuid) {
-		idList.add(uuid);
-		return;
-	}
-
-	public RuntimeCloudException(String message) {
-		super(message);
-		setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
-	}
-
-    public RuntimeCloudException(String message, Throwable cause) {
-        super(message, cause);
-        setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
-    }
-
-    public void addProxyObject(Object voObj, Long id, String idFieldName) {
-    	// Get the VO object's table name.
-    	String tablename = AnnotationHelper.getTableName(voObj);
-    	if (tablename != null) {
-    		addProxyObject(tablename, id, idFieldName);
-    	}
-    	return;
-    }
-
-	public RuntimeCloudException() {
-		super();
-		setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName()));
-	}
-
-	public ArrayList<String> getIdProxyList() {
-		return idList;
-	}
-
-	public void setCSErrorCode(int cserrcode) {
-		this.csErrorCode = cserrcode;
-	}
-
-	public int getCSErrorCode() {
-		return this.csErrorCode;
-	}
-}