Ejemplo n.º 1
0
 public static EISException createException(Object[] args, int errorCode) {
   EISException exception =
       new EISException(
           ExceptionMessageGenerator.buildMessage(EISException.class, errorCode, args));
   exception.setErrorCode(errorCode);
   return exception;
 }
Ejemplo n.º 2
0
 public static EISException createResourceException(Object[] args, int errorCode) {
   ResourceException resourceException =
       new ResourceException(
           ExceptionMessageGenerator.buildMessage(EISException.class, errorCode, args));
   EISException exception = new EISException(resourceException);
   exception.setErrorCode(RESOURCE_EXCEPTION);
   exception.setInternalException(resourceException);
   return exception;
 }
 /**
  * Handles an invalid type setting in a schema reference.
  *
  * @see org.eclipse.persistence.platform.xml.XMLSchemaReference.getType()
  */
 public static XMLPlatformException xmlPlatformInvalidTypeException(int type) {
   Object[] args = {Integer.valueOf(type)};
   int errorCode = XML_PLATFORM_INVALID_TYPE;
   XMLPlatformException exception =
       new XMLPlatformException(
           ExceptionMessageGenerator.buildMessage(XMLPlatformException.class, errorCode, args));
   exception.setErrorCode(errorCode);
   return exception;
 }
 public static XMLPlatformException xmlPlatformCouldNotCreateDocument(Exception nestedException) {
   Object[] args = {};
   int errorCode = XML_PLATFORM_COULD_NOT_CREATE_DOCUMENT;
   XMLPlatformException exception =
       new XMLPlatformException(
           ExceptionMessageGenerator.buildMessage(XMLPlatformException.class, errorCode, args));
   exception.setErrorCode(errorCode);
   return exception;
 }
Ejemplo n.º 5
0
 public static EISException incorrectLoginInstanceProvided(Class loginClass) {
   Object[] args = {loginClass};
   EISException exception =
       new EISException(
           ExceptionMessageGenerator.buildMessage(
               EISException.class, INCORRECT_LOGIN_INSTANCE_PROVIDED, args));
   exception.setErrorCode(INCORRECT_LOGIN_INSTANCE_PROVIDED);
   return exception;
 }
  public static OptimisticLockException mustHaveMappingWhenStoredInObject(Class aClass) {
    Object[] args = {aClass};

    OptimisticLockException optimisticLockException =
        new OptimisticLockException(
            ExceptionMessageGenerator.buildMessage(
                OptimisticLockException.class, MUST_HAVE_MAPPING_WHEN_IN_OBJECT, args));
    optimisticLockException.setErrorCode(MUST_HAVE_MAPPING_WHEN_IN_OBJECT);
    return optimisticLockException;
  }
  public static OptimisticLockException batchStatementExecutionFailure() {
    Object[] args = {};

    OptimisticLockException optimisticLockException =
        new OptimisticLockException(
            ExceptionMessageGenerator.buildMessage(
                OptimisticLockException.class, STATEMENT_NOT_EXECUTED_IN_BATCH, args));
    optimisticLockException.setErrorCode(STATEMENT_NOT_EXECUTED_IN_BATCH);
    return optimisticLockException;
  }
  // For CR#2281
  public static OptimisticLockException needToMapJavaSqlTimestampWhenStoredInObject() {
    Object[] args = {};

    OptimisticLockException optimisticLockException =
        new OptimisticLockException(
            ExceptionMessageGenerator.buildMessage(
                OptimisticLockException.class, NEED_TO_MAP_JAVA_SQL_TIMESTAMP, args));
    optimisticLockException.setErrorCode(NEED_TO_MAP_JAVA_SQL_TIMESTAMP);
    return optimisticLockException;
  }
  public static OptimisticLockException objectChangedSinceLastMerge(Object object) {
    Object[] args = {object, object.getClass().getName(), CR};

    OptimisticLockException optimisticLockException =
        new OptimisticLockException(
            ExceptionMessageGenerator.buildMessage(
                OptimisticLockException.class, OBJECT_CHANGED_SINCE_LAST_MERGE, args));
    optimisticLockException.setErrorCode(OBJECT_CHANGED_SINCE_LAST_MERGE);
    return optimisticLockException;
  }
 public static XMLPlatformException xmlPlatformValidationException(Exception nestedException) {
   Object[] args = {};
   int errorCode = XML_PLATFORM_VALIDATION_EXCEPTION;
   XMLPlatformException exception =
       new XMLPlatformException(
           ExceptionMessageGenerator.buildMessage(XMLPlatformException.class, errorCode, args));
   exception.setErrorCode(errorCode);
   exception.setInternalException(nestedException);
   return exception;
 }
 public static XMLPlatformException xmlPlatformInvalidXPath(Exception nestedException) {
   Object[] args = {};
   int errorCode = XML_PLATFORM_INVALID_XPATH;
   XMLPlatformException exception =
       new XMLPlatformException(
           ExceptionMessageGenerator.buildMessage(XMLPlatformException.class, errorCode, args));
   exception.setErrorCode(errorCode);
   exception.setInternalException(nestedException);
   return exception;
 }
  public static OptimisticLockException unwrappingObjectDeletedSinceLastRead(
      Vector pkVector, String className) {
    Object[] args = {pkVector, className};

    OptimisticLockException optimisticLockException =
        new OptimisticLockException(
            ExceptionMessageGenerator.buildMessage(
                OptimisticLockException.class, UNWRAPPING_OBJECT_DELETED_SINCE_LAST_READ, args));
    optimisticLockException.setErrorCode(UNWRAPPING_OBJECT_DELETED_SINCE_LAST_READ);
    return optimisticLockException;
  }
 public static XMLPlatformException xmlPlatformFileNotFoundException(
     File file, IOException nestedException) {
   Object[] args = {file.getAbsolutePath()};
   int errorCode = XML_PLATFORM_PARSER_FILE_NOT_FOUND_EXCEPTION;
   XMLPlatformException exception =
       new XMLPlatformException(
           ExceptionMessageGenerator.buildMessage(XMLPlatformException.class, errorCode, args));
   exception.setErrorCode(errorCode);
   exception.setInternalException(nestedException);
   return exception;
 }
 public static XMLPlatformException xmlPlatformCouldNotInstantiate(
     String xmlPlatformClassName, Exception nestedException) {
   Object[] args = {xmlPlatformClassName};
   int errorCode = XML_PLATFORM_COULD_NOT_INSTANTIATE;
   XMLPlatformException exception =
       new XMLPlatformException(
           ExceptionMessageGenerator.buildMessage(XMLPlatformException.class, errorCode, args));
   exception.setErrorCode(errorCode);
   exception.setInternalException(nestedException);
   return exception;
 }
 public static XMLPlatformException xmlPlatformClassNotFound(
     String xmlPlatformClassName, Exception nestedException) {
   Object[] args = {xmlPlatformClassName};
   int errorCode = XML_PLATFORM_CLASS_NOT_FOUND;
   XMLPlatformException exception =
       new XMLPlatformException(
           ExceptionMessageGenerator.buildMessage(XMLPlatformException.class, errorCode, args));
   exception.setErrorCode(errorCode);
   exception.setInternalException(nestedException);
   return exception;
 }
 public static XMLPlatformException xmlPlatformErrorResolvingXMLSchemas(
     Object[] schemas, Exception nestedException) {
   Object[] args = {};
   int errorCode = XML_PLATFORM_PARSER_ERROR_RESOLVING_XML_SCHEMA;
   XMLPlatformException exception =
       new XMLPlatformException(
           ExceptionMessageGenerator.buildMessage(XMLPlatformException.class, errorCode, args));
   exception.setErrorCode(errorCode);
   exception.setInternalException(nestedException);
   return exception;
 }
 public static XMLPlatformException xmlPlatformSAXParseException(
     SAXParseException nestedException) {
   Object[] args = {
     Integer.valueOf(nestedException.getLineNumber()),
     nestedException.getSystemId(),
     nestedException.getMessage()
   };
   int errorCode = XML_PLATFORM_PARSER_SAX_PARSE_EXCEPTION;
   XMLPlatformException exception =
       new XMLPlatformException(
           ExceptionMessageGenerator.buildMessage(XMLPlatformException.class, errorCode, args));
   exception.setErrorCode(errorCode);
   exception.setInternalException(nestedException);
   return exception;
 }
  public static OptimisticLockException objectChangedSinceLastReadWhenUpdating(
      Object object, ObjectLevelModifyQuery query) {
    Vector key = new Vector();
    if (query.getSession() != null) {
      key = query.getSession().keyFromObject(object);
    }
    Object[] args = {object, object.getClass().getName(), key, CR};

    OptimisticLockException optimisticLockException =
        new OptimisticLockException(
            ExceptionMessageGenerator.buildMessage(
                OptimisticLockException.class, OBJECT_CHANGED_SINCE_LAST_READ_WHEN_UPDATING, args),
            query);
    optimisticLockException.setErrorCode(OBJECT_CHANGED_SINCE_LAST_READ_WHEN_UPDATING);
    return optimisticLockException;
  }
  public static OptimisticLockException noVersionNumberWhenDeleting(
      Object object, ObjectLevelModifyQuery query) {
    Vector key = new Vector();
    if (query.getSession() != null) {
      key = query.getSession().keyFromObject(object);
    }
    Object[] args = {object, object.getClass().getName(), key, CR};

    OptimisticLockException optimisticLockException =
        new OptimisticLockException(
            ExceptionMessageGenerator.buildMessage(
                OptimisticLockException.class, NO_VERSION_NUMBER_WHEN_DELETING, args),
            query);
    optimisticLockException.setErrorCode(NO_VERSION_NUMBER_WHEN_DELETING);
    return optimisticLockException;
  }