Bug 13127: API error text refer to database ids instead of uuids

Description:

1)	Moved RuntimeCloudException from api/ to utils/.

	Added simple constructor to RuntimeCloudException.

	Modified all classes that extended RuntimeException
	to extend RuntimeCloudException. These classes
	are listed below:

		ServerApiException
		CloudAuthenticationException
		CloudExecutionException
		AsyncCommandQueued
		HypervisorVersionChangedException
		RuntimeCloudException

2)	Added overloaded constructed to CloudException.
	Modified all classes that extend Exception to extend CloudException instead.
	These classes are listed below:

		ConcurrentOperationException
                ConflictingNetworkSettingsException
                ConnectionException
                DiscoveryException
                InsufficientCapacityException
                ManagementServerException
                ResourceUnavailableException
                VirtualMachineMigrationException
                AgentControlChannelException
                OperationTimedoutException.java
                UnsupportedVersionException.java
                UsageServerException.java
                UnableDeleteHostException.java
                AgentAuthnException.java
                HttpCallException.java
                ActiveFencingException.java
                ClusterInvalidSessionException.java
                GreTunnelException.java
                OvsVlanExhaustedException.java
This commit is contained in:
Vijayendra Bhamidipati 2012-02-02 20:45:55 -08:00
parent 698c1ebe12
commit 768d7a2a26
26 changed files with 58 additions and 29 deletions

View File

@ -17,9 +17,10 @@
*/
package com.cloud.api;
import com.cloud.utils.exception.RuntimeCloudException;
@SuppressWarnings("serial")
public class ServerApiException extends RuntimeException {
public class ServerApiException extends RuntimeCloudException {
private int _errorCode;
private String _description;

View File

@ -18,8 +18,9 @@
package com.cloud.exception;
import com.cloud.utils.SerialVersionUID;
import com.cloud.utils.exception.RuntimeCloudException;
public class CloudAuthenticationException extends RuntimeException {
public class CloudAuthenticationException extends RuntimeCloudException {
private static final long serialVersionUID = SerialVersionUID.CloudAuthenticationException;
public CloudAuthenticationException(String message) {

View File

@ -41,10 +41,15 @@ public class CloudException extends Exception {
public CloudException(String message) {
super(message);
}
public CloudException(String message, Throwable cause) {
super(message, cause);
}
public CloudException() {
//this.id = new IdentityProxy(); ??
//this.id = NULL; ??
super();
}
}

View File

@ -18,6 +18,7 @@
package com.cloud.exception;
import java.util.HashMap;
import com.cloud.utils.exception.RuntimeCloudException;
import com.cloud.utils.SerialVersionUID;
@ -30,7 +31,7 @@ import com.cloud.utils.SerialVersionUID;
* that one can find out what the error is simply by reading the error message.
*
*/
public class CloudExecutionException extends RuntimeException {
public class CloudExecutionException extends RuntimeCloudException {
private final static long serialVersionUID = SerialVersionUID.CloudExecutionException;
private final ErrorCode code;

View File

@ -19,7 +19,7 @@ package com.cloud.exception;
import com.cloud.utils.SerialVersionUID;
public class ConcurrentOperationException extends Exception {
public class ConcurrentOperationException extends CloudException {
private static final long serialVersionUID = SerialVersionUID.ConcurrentOperationException;

View File

@ -23,7 +23,7 @@ package com.cloud.exception;
import com.cloud.utils.SerialVersionUID;
public class ConflictingNetworkSettingsException extends Exception {
public class ConflictingNetworkSettingsException extends CloudException {
private static final long serialVersionUID = SerialVersionUID.ConflictingNetworkSettingException;

View File

@ -34,7 +34,7 @@ import com.cloud.utils.SerialVersionUID;
* It is important that the Listener does not fall into a loop in this
* situation where it keeps throwing ConnectionException.
*/
public class ConnectionException extends Exception {
public class ConnectionException extends CloudException {
private static final long serialVersionUID = SerialVersionUID.ConnectionException;
boolean _error;

View File

@ -19,7 +19,7 @@ package com.cloud.exception;
import com.cloud.utils.SerialVersionUID;
public class DiscoveryException extends Exception {
public class DiscoveryException extends CloudException {
private static final long serialVersionUID = SerialVersionUID.DiscoveryException;

View File

@ -23,7 +23,7 @@ import com.cloud.utils.SerialVersionUID;
* Generic parent exception class for capacity being reached.
*
*/
public abstract class InsufficientCapacityException extends Exception {
public abstract class InsufficientCapacityException extends CloudException {
private static final long serialVersionUID = SerialVersionUID.InsufficientCapacityException;
Long id;

View File

@ -23,7 +23,7 @@ import com.cloud.utils.SerialVersionUID;
* @author chiradeep
*
*/
public class ManagementServerException extends Exception {
public class ManagementServerException extends CloudException {
private static final long serialVersionUID = SerialVersionUID.ManagementServerException;

View File

@ -19,7 +19,7 @@ package com.cloud.exception;
import com.cloud.utils.SerialVersionUID;
public class ResourceUnavailableException extends Exception {
public class ResourceUnavailableException extends CloudException {
private static final long serialVersionUID = SerialVersionUID.ResourceUnavailableException;
Class<?> _scope;

View File

@ -19,7 +19,7 @@ package com.cloud.exception;
import com.cloud.utils.SerialVersionUID;
public class VirtualMachineMigrationException extends Exception {
public class VirtualMachineMigrationException extends CloudException {
private static final long serialVersionUID = SerialVersionUID.VirtualMachineMigrationException;
public VirtualMachineMigrationException(String message) {

View File

@ -17,8 +17,10 @@
*/
package com.cloud.exception;
import com.cloud.exception.CloudException;
public class AgentControlChannelException extends Exception {
public class AgentControlChannelException extends CloudException {
private static final long serialVersionUID = -310647782960500466L;
public AgentControlChannelException(String msg) {

View File

@ -24,7 +24,7 @@ import com.cloud.utils.SerialVersionUID;
* This exception is thrown when the operation couldn't complete due to a
* wait timeout.
*/
public class OperationTimedoutException extends Exception {
public class OperationTimedoutException extends CloudException {
private static final long serialVersionUID = SerialVersionUID.OperationTimedoutException;
long _agentId;

View File

@ -22,7 +22,7 @@ import com.cloud.utils.SerialVersionUID;
/**
* Version of the protocol is no longer supported.
*/
public class UnsupportedVersionException extends Exception {
public class UnsupportedVersionException extends CloudException {
private static final long serialVersionUID = SerialVersionUID.UnsupportedVersionException;

View File

@ -17,7 +17,7 @@
*/
package com.cloud.exception;
public class UsageServerException extends Exception {
public class UsageServerException extends CloudException {
public UsageServerException() {

View File

@ -1,8 +1,9 @@
package com.cloud.resource;
import com.cloud.utils.SerialVersionUID;
import com.cloud.exception.CloudException;
public class UnableDeleteHostException extends Exception {
public class UnableDeleteHostException extends CloudException {
private static final long serialVersionUID = SerialVersionUID.UnableDeleteHostException;
public UnableDeleteHostException(String msg) {

View File

@ -17,11 +17,13 @@
*/
package com.cloud.agent.manager.authn;
import com.cloud.exception.CloudException;
/**
* Exception indicates authentication and/OR authorization problem
*
*/
public class AgentAuthnException extends Exception{
public class AgentAuthnException extends CloudException{
private static final long serialVersionUID = 3303508953403051189L;

View File

@ -18,8 +18,9 @@
package com.cloud.async;
import com.cloud.utils.SerialVersionUID;
import com.cloud.utils.exception.RuntimeCloudException;
public class AsyncCommandQueued extends RuntimeException {
public class AsyncCommandQueued extends RuntimeCloudException {
private static final long serialVersionUID = SerialVersionUID.AsyncCommandQueued;
private SyncQueueVO _queue = null;

View File

@ -21,7 +21,9 @@ package com.cloud.baremetal;
import com.cloud.utils.SerialVersionUID;
public class HttpCallException extends Exception {
import com.cloud.exception.CloudException;
public class HttpCallException extends CloudException {
private static final long serialVersionUID= SerialVersionUID.HttpCallException;
public HttpCallException(String msg) {
super(msg);

View File

@ -18,7 +18,9 @@
package com.cloud.cluster;
public class ActiveFencingException extends Exception {
import com.cloud.exception.CloudException;
public class ActiveFencingException extends CloudException {
private static final long serialVersionUID = -3975376101728211726L;
public ActiveFencingException(String message) {

View File

@ -18,7 +18,9 @@
package com.cloud.cluster;
public class ClusterInvalidSessionException extends Exception {
import com.cloud.exception.CloudException;
public class ClusterInvalidSessionException extends CloudException {
private static final long serialVersionUID = -6636524194520997512L;

View File

@ -18,7 +18,9 @@
package com.cloud.network.ovs;
public class GreTunnelException extends Exception {
import com.cloud.exception.CloudException;
public class GreTunnelException extends CloudException {
public GreTunnelException(String msg) {
super(msg);
}

View File

@ -18,7 +18,9 @@
package com.cloud.network.ovs;
public class OvsVlanExhaustedException extends Exception {
import com.cloud.exception.CloudException;
public class OvsVlanExhaustedException extends CloudException {
public OvsVlanExhaustedException(String msg) {
super(msg);
}

View File

@ -19,7 +19,7 @@ package com.cloud.utils.exception;
import com.cloud.utils.SerialVersionUID;
public class HypervisorVersionChangedException extends RuntimeException {
public class HypervisorVersionChangedException extends RuntimeCloudException {
private static final long serialVersionUID = SerialVersionUID.CloudRuntimeException;

View File

@ -15,16 +15,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.exception;
package com.cloud.utils.exception;
import com.cloud.utils.IdentityProxy;
/**
* CloudException is a generic exception class that has an IdentityProxy
* RuntimeCloudException is a generic exception class that has an IdentityProxy
* object in it to enable on the fly conversion of database ids to uuids
* by the API response serializer. Any exceptions that are thrown by
* command invocations must extend this class, or the RuntimeCloudException
* class, which extends RuntimeException instead of Exception like this
* command invocations must extend this class, or the CloudException
* class, which extends Exception instead of RuntimeException like this
* class does.
*/
@ -42,9 +42,14 @@ public class RuntimeCloudException extends RuntimeException {
super(message);
}
public RuntimeCloudException(String message, Throwable cause) {
super(message, cause);
}
public RuntimeCloudException() {
//this.id = new IdentityProxy(); ??
//this.id = NULL; ??
super();
}
}