本文整理汇总了Java中com.vangav.backend.exceptions.VangavException类的典型用法代码示例。如果您正苦于以下问题:Java VangavException类的具体用法?Java VangavException怎么用?Java VangavException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VangavException类属于com.vangav.backend.exceptions包,在下文中一共展示了VangavException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CycleLog
import com.vangav.backend.exceptions.VangavException; //导入依赖的package包/类
/**
* Constructor - CycleLog
* @param plannedStartTime
* @param actualStartTime
* @param plannedEndTime
* @return new CycleLog Object
*/
protected CycleLog (
long plannedStartTime,
long actualStartTime,
long plannedEndTime) {
this.plannedStartTime = plannedStartTime;
this.actualStartTime = actualStartTime;
this.plannedEndTime = plannedEndTime;
this.actualEndTime = this.actualStartTime;
this.nonFatalVangavExceptions = new ArrayList<VangavException>();
this.nonFatalExceptions = new ArrayList<Exception>();
this.finished = false;
this.succeeded = false;
this.failureException = null;
}
示例2: checkInstanceOf
import com.vangav.backend.exceptions.VangavException; //导入依赖的package包/类
/**
* checkInstanceOf
* @param object: the object to be checked
* @param type: expected class type
* @param exceptionType: exception type to throw
* (bad request or code exception)
* @throws VangavException
* */
public static void checkInstanceOf (
Object object,
Class<?> type,
ExceptionType exceptionType) throws Exception {
if (object.getClass().equals(type) == false) {
throw VangavException.exceptionFactory(
41,
1,
"Wrong class type ["
+ object.getClass().getName()
+ "] expecting ["
+ type.getName()
+ "]",
exceptionType,
ExceptionClass.ARGUMENT);
}
}
示例3: checkNotNull
import com.vangav.backend.exceptions.VangavException; //导入依赖的package包/类
/**
* checkNotNull
* @param name: name of the object to be checked
* @param object: object to be checked
* @param exceptionType: exception type to throw
* (bad request or code exception)
* @throws VangavException
* */
public static void checkNotNull (
String name,
Object object,
ExceptionType exceptionType) throws Exception {
if (object == null) {
throw VangavException.exceptionFactory(
41,
2,
name
+ " can't be null",
exceptionType,
ExceptionClass.ARGUMENT);
}
}
示例4: checkNotEmpty
import com.vangav.backend.exceptions.VangavException; //导入依赖的package包/类
/**
* checkNotEmpty
* @param name
* @param string
* @param exceptionType
* @throws Exception if param string is null or empty
*/
public static void checkNotEmpty (
String name,
String string,
ExceptionType exceptionType) throws Exception {
checkNotNull(name, string, exceptionType);
if (string.length() == 0) {
throw VangavException.exceptionFactory(
41,
3,
name
+ " can't be empty",
exceptionType,
ExceptionClass.ARGUMENT);
}
}
示例5: checkIntWithinRange
import com.vangav.backend.exceptions.VangavException; //导入依赖的package包/类
/**
* checkIntWithinRange
* @param name: name of the integer to be checked
* @param value: value of the integer to be checked
* @param min: minimum valid value
* @param max: maximum valid value
* @param exceptionType: exception type to throw
* (bad request or code exception)
* @throws VangavException
* */
public static void checkIntWithinRange (
String name,
int value,
int min,
int max,
ExceptionType exceptionType) throws Exception {
if (value < min || value > max) {
throw VangavException.exceptionFactory(
41,
12,
name
+ " value ["
+ value
+ "] min ["
+ min
+ "] max ["
+ max
+ "] is out of range",
exceptionType,
ExceptionClass.ARGUMENT);
}
}
示例6: checkIntGreaterThanOrEqual
import com.vangav.backend.exceptions.VangavException; //导入依赖的package包/类
/**
* checkIntGreaterThanOrEqual
* @param name: name of the integer to be checked
* @param value: value of the integer to be checked
* @param minLimit: minimum valid value
* @param exceptionType: exception type to throw
* (bad request or code exception)
* @throws VangavException
* */
public static void checkIntGreaterThanOrEqual (
String name,
int value,
int minLimit,
ExceptionType exceptionType) throws Exception {
if (value < minLimit) {
throw VangavException.exceptionFactory(
41,
13,
name
+ " value ["
+ value
+ "] min limit ["
+ minLimit
+ "] is less than the minimum limit",
exceptionType,
ExceptionClass.ARGUMENT);
}
}
示例7: checkLongGreaterThanOrEqual
import com.vangav.backend.exceptions.VangavException; //导入依赖的package包/类
/**
* checkLongGreaterThanOrEqual
* @param name: name of the long to be checked
* @param value: value of the long to be checked
* @param minLimit: minimum valid value
* @param exceptionType: exception type to throw
* (bad request or code exception)
* @throws VangavException
* */
public static void checkLongGreaterThanOrEqual (
String name,
long value,
long minLimit,
ExceptionType exceptionType) throws Exception {
if (value < minLimit) {
throw VangavException.exceptionFactory(
41,
14,
name
+ " value ["
+ value
+ "] min limit ["
+ minLimit
+ "] is less than the minimum limit",
exceptionType,
ExceptionClass.ARGUMENT);
}
}
示例8: checkDoubleHasValue
import com.vangav.backend.exceptions.VangavException; //导入依赖的package包/类
/**
* checkDoubleHasValue
* throws an exception is param value is NAN or infinite
* @param name
* @param value
* @param exceptionType
* @throws Exception
*/
public static void checkDoubleHasValue (
String name,
double value,
ExceptionType exceptionType) throws Exception {
if (Double.isNaN(value) || Double.isInfinite(value) ) {
throw VangavException.exceptionFactory(
41,
15,
name
+ " double ["
+ value
+ "] has no value",
exceptionType,
ExceptionClass.ARGUMENT);
}
}
示例9: Request
import com.vangav.backend.exceptions.VangavException; //导入依赖的package包/类
/**
* Constructor Request
* @param request (play framework request)
* @param requestJsonBody
* @param responseBody
* @param controllerName
* @return new Request Object
* @throws Exception
*/
public Request (
play.mvc.Http.Request request,
RequestJsonBody requestJsonBody,
ResponseBody responseBody,
String controllerName) throws Exception {
this.startTime = System.currentTimeMillis();
this.startCalendar =
CalendarAndDateOperationsInl.getCalendarFromUnixTime(this.startTime);
this.endTime = this.startTime;
this.execTime = 0;
this.requestId = UUID.randomUUID();
this.header = new RequestHeader(request);
this.body = requestJsonBody;
this.response = responseBody;
this.dispatcher = new Dispatcher();
this.controllerName = controllerName;
this.userId = this.body.getUserId();
this.isThrottled = false;
this.state = RequestState.OK;
this.vangavExceptions = new ArrayList<VangavException>();
this.exceptions = new ArrayList<Exception>();
}
示例10: checkIpV4
import com.vangav.backend.exceptions.VangavException; //导入依赖的package包/类
/**
* checkIpV4
* throws an exception if param ip isn't a valid IP V4
* @param name
* @param ip
* @param exceptionType
* @throws Exception
*/
public static void checkIpV4 (
String name,
String ip,
ExceptionType exceptionType) throws Exception {
try {
String [] ipSplit = ip.split("\\.");
int currValue;
for (int i = 0; i < 4; i ++) {
currValue = Integer.parseInt(ipSplit[i] );
checkIntWithinRange(
"",
currValue,
0,
255,
exceptionType);
}
} catch (Exception e) {
throw VangavException.exceptionFactory(
41,
16,
name
+ " Invalid IP V4 ["
+ ip
+ "]",
exceptionType,
ExceptionClass.ARGUMENT);
}
}
示例11: endCallWithExceptions
import com.vangav.backend.exceptions.VangavException; //导入依赖的package包/类
/**
* endCallWithExceptions
* used instead of endCall in case an exception got thrown during processing
* invoked at the end of each call from ControllerCall's run method to
* complete a controller's call log
* @param e
*/
protected void endCallWithExceptions (Exception e) {
this.requestToResponseTimeInMilliSeconds =
(int) (System.currentTimeMillis() - this.startTime);
this.responseHttpStatusCode = -2;
this.response = ErrorResponse.getDefaultErrorResponse();
this.threwExceptionsDuringCall = true;
this.thrownException = VangavException.getExceptionStackTrace(e);
}
示例12: getNonFatalVangavExceptions
import com.vangav.backend.exceptions.VangavException; //导入依赖的package包/类
/**
* getNonFatalVangavExceptions
* @return this cycle's non-fatal vangav exceptions
* @throws Exception
*/
public ArrayList<VangavException> getNonFatalVangavExceptions (
) throws Exception {
return this.nonFatalVangavExceptions;
}
示例13: getNonFatalExceptionsAsString
import com.vangav.backend.exceptions.VangavException; //导入依赖的package包/类
/**
* getNonFatalExceptionsAsString
* @return this cycle's non fatal exceptions in string form for the toString
* method
*/
private ArrayList<String> getNonFatalExceptionsAsString () {
ArrayList<String> result = new ArrayList<String>();
try {
for (Exception exception : this.nonFatalExceptions) {
if (exception instanceof VangavException) {
result.add(((VangavException)exception).toString() );
} else {
result.add(VangavException.getExceptionStackTrace(exception) );
}
}
} catch (Exception e) {
result.add("Failed to continue because of an exception");
}
return result;
}
示例14: getFailureExceptionAsString
import com.vangav.backend.exceptions.VangavException; //导入依赖的package包/类
/**
* getFailureExceptionAsString
* @return this cycle's failure exception in string form for the toString
* method
*/
private String getFailureExceptionAsString () {
if (this.failureException == null) {
return "no failure exception";
}
if (this.failureException instanceof VangavException) {
return ((VangavException)this.failureException).toString();
} else {
return VangavException.getExceptionStackTrace(this.failureException);
}
}
示例15: getAllExceptionsAsString
import com.vangav.backend.exceptions.VangavException; //导入依赖的package包/类
/**
* getAllExceptionsAsString
* @return both VangavException and Exception exceptions' stack traces as
* as a String
* @throws Exception
*/
public String getAllExceptionsAsString () throws Exception {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("VANGAV EXCEPTIONS\n\n");
for (VangavException vangavException : this.vangavExceptions) {
stringBuffer.append(vangavException.toString() );
stringBuffer.append("\n\n");
}
stringBuffer.append("\n\nEXCEPTIONS\n\n");
for (Exception exception : this.exceptions) {
stringBuffer.append(VangavException.getExceptionStackTrace(exception) );
stringBuffer.append("\n\n");
}
return stringBuffer.toString();
}