Consolidate RuntimeCloudException and CloudRuntimeException into one

class CloudRuntimeException, and removed RuntimeCloudException to avoid
confusion.
This commit is contained in:
Min Chen 2013-01-15 18:07:08 -08:00
parent f6a8b45de5
commit 8608925216
8 changed files with 55 additions and 92 deletions

View File

@ -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) {

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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;
}
}