当前位置: 首页>>代码示例>>Java>>正文


Java VangavException类代码示例

本文整理汇总了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;
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:25,代码来源:CycleLog.java

示例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);
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:28,代码来源:ArgumentsInl.java

示例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);
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:25,代码来源:ArgumentsInl.java

示例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);
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:26,代码来源:ArgumentsInl.java

示例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);
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:35,代码来源:ArgumentsInl.java

示例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);
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:31,代码来源:ArgumentsInl.java

示例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);
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:31,代码来源:ArgumentsInl.java

示例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);
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:27,代码来源:ArgumentsInl.java

示例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>();
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:36,代码来源:Request.java

示例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);
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:43,代码来源:ArgumentsInl.java

示例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);
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:19,代码来源:ControllerCallLog.java

示例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;
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:11,代码来源:CycleLog.java

示例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;
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:29,代码来源:CycleLog.java

示例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);
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:21,代码来源:CycleLog.java

示例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();
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:29,代码来源:Request.java


注:本文中的com.vangav.backend.exceptions.VangavException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。