Exceptions

ODB use a single Runtime Exception to handle errors : org.neodatis.odb.ODBRuntimeException.

The constructor of ODBRuntimeException receive always receive an instance of org.neodatis.IError:

    public ODBRuntimeException(IError error, Throwable t)
 
    public ODBRuntimeException(IError error)
 
    public ODBRuntimeException(IError error, String message)
 
    public ODBRuntimeException(IError error, String message,Throwable t)

Class implementing IError

IError.png

There exist two types of Error:

  • Internal error
  • User Error

Current Error catalog of Internal Error

public static final Error NULL_NEXT_OBJECT_OID = new Error(100, "ODB has detected an inconsistency while reading instance(of @) #@ over @ with oid @ which has a null 'next object oid'");
    public static final Error INSTANCE_POSITION_OUT_OF_FILE = new Error(101, "ODB is trying to read an instance at position @ which is out of the file - File size is @");
    public static final Error INSTANCE_POSITION_IS_NEGATIVE = new Error(102, "ODB is trying to read an instance at a negative position @ , oid=@ : @");
    public static final Error WRONG_TYPE_FOR_BLOCK_TYPE = new Error(201, "Block type of wrong type : expected @, Found @ at position @");
    public static final Error WRONG_BLOCK_SIZE = new Error(202, "Wrong Block size : expected @, Found @ at position @");
    public static final Error WRONG_OID_AT_POSITION = new Error(203, "Reading object with oid @ at position @, but found oid @");
    public static final Error BLOCK_NUMBER_DOES_EXIST = new Error(205, "Block(of ids) with number @ does not exist");
    public static final Error FOUND_POINTER = new Error(204, "Found a pointer foi oid @ at position @");
    public static final Error OBJECT_IS_MARKED_AS_DELETED_FOR_OID = new Error(206, "Object with oid @ is marked as deleted");
    public static final Error OBJECT_IS_MARKED_AS_DELETED_FOR_POSITION = new Error(207, "Object with position @ is marked as deleted");    
    public static final Error NATIVE_TYPE_NOT_SUPPORTED = new Error(208, "Native type not supported @ @");
    public static final Error NATIVE_TYPE_DIVERGENCE = new Error(209, "Native type informed(@) is different from the one informed (@)");
    public static final Error NEGATIVE_CLASS_NUMBER_IN_HEADER = new Error(210, "number of classes is negative while reading database header : @ at position @");
    public static final Error UNKNOWN_BLOCK_TYPE = new Error(211, "Unknown block type @ at @");
    public static final Error UNSUPPORTED_IO_TYPE = new Error(212, "Unsupported IO Type : @");
    public static final Error OBJECT_DOES_NOT_EXIST_IN_CACHE = new Error(213, "Object does not exist in cache");
    public static final Error OBJECT_WITH_OID_DOES_NOT_EXIST_IN_CACHE = new Error(213, "Object with oid @ does not exist in cache");
    public static final Error OBJECT_INFO_NOT_IN_TEMP_CACHE = new Error(214, "ObjectInfo does not exist in temporary cache oid=@ and position=@");
    public static final Error CAN_NOT_DELETE_FILE = new Error(215, "Can not delete file @");
    public static final Error GO_TO_POSITION = new Error(216, "Error while going to position @, length = @");
    public static final Error ABSTRACT_IO_NOT_IMPLEMENTED = new Error(217, "Abstract IO not implemented @");
    public static final Error UNDEFINED_CLASS_INFO = new Error(218, "Undefined class info for @");
    public static final Error ABSTRACT_OBJECT_INFO_TYPE_NOT_SUPPORTED = new Error(219, "Abstract Object Info type not supported : @");
    public static final Error NEGATIVE_BLOCK_SIZE = new Error(220, "Negative block size at @ : size = @, object=@");
    public static final Error INPLACE_UPDATE_NOT_POSSIBLE_FOR_ARRAY = new Error(221, "Array in place update with array smaller than element array index to update : array size=@, element index=@");
    public static final Error OPERATION_NOT_IMPLEMENTED = new Error(222,"Operation not supported : @");
    public static final Error INSTANCE_BUILDER_WRONG_OBJECT_TYPE = new Error(223,"Wrong type of object: expecting @ and received @");
    public static final Error INSTANCE_BUILDER_WRONG_OBJECT_CONTAINER_TYPE = new Error(224,"Building instance of @ : can not put a @ into a @");
    public static final Error INSTANCE_BUILDER_NATIVE_TYPE_IN_COLLECTION_NOT_SUPPORTED = new Error(225,"Native @ in Collection(List,array,Map) not supported");            
    public static final Error OBJECT_INTROSPECTOR_NO_FIELD_WITH_NAME = new Error(226,"Class/Interface @ do not have attribute '@'");
    public static final Error OBJECT_INTROSPECTOR_CLASS_NOT_FOUND = new Error(227,"Class not found : @");
    public static final Error CLASS_POOL_CREATE_CLASS = new Error(228,"Error while creating (reflection) class @");
    public static final Error BUFFER_TOO_SMALL = new Error(229,"Buffer too small: buffer size = @ and data size = @ - should not happen");
    public static final Error FILE_INTERFACE_WRITE_BYTES_NOT_IMPLEMENTED_FOR_TRANSACTION = new Error(230,"writeBytes not implemented for transactions");
    public static final Error FILE_INTERFACE_READ_ERROR = new Error(231,"Error reading @ bytes at @ : read @ bytes instead");
    public static final Error POINTER_TO_SELF = new Error(232,"Error while creating a pointer : a pointer to itself : @ -> @ for oid @");
    public static final Error INDEX_NOT_FOUND = new Error(233,"No index defined on class @ at index position @");
    public static final Error NOT_YET_IMPLEMENTED = new Error(234,"Not yet implemented : @");
    public static final Error META_MODEL_CLASS_NAME_DOES_NOT_EXIST = new Error(235,"Class @ does not exist in meta-model");
    public static final Error META_MODEL_CLASS_WITH_OID_DOES_NOT_EXIST = new Error(236,"Class with oid @ does not exist in meta-model");
    public static final Error META_MODEL_CLASS_WITH_POSITION_DOES_NOT_EXIST = new Error(237,"Class with position @ does not exist in meta-model");
    public static final Error CLASS_INFO_DO_NOT_HAVE_THE_ATTRIBUTE = new Error(238,"Class @ does not have attribute with name @");
    public static final Error ODB_TYPE_ID_DOES_NOT_EXIST = new Error(239,"ODBtype with id @ does not exist");
    public static final Error ODB_TYPE_NATIVE_TYPE_WITH_ID_DOES_NOT_EXIST = new Error(240,"Native type with id @ does not exist");
    public static final Error QUERY_ENGINE_NOT_SET = new Error(241,"Storage engine not set on query");
    public static final Error QUERY_TYPE_NOT_IMPLEMENTED = new Error(242,"Query type @ not implemented");
    public static final Error CRYPTO_ALGORITH_NOT_FOUND = new Error(243,"Could not get the MD5 algorithm to encrypt the password");
    public static final Error XML_HEADER = new Error(244,"Error while creating XML Header");
    public static final Error XML_RESERVING_IDS = new Error(245,"Error while reserving @ ids");
    public static final Error XML_SETTING_META_MODEL = new Error(246,"Error while setting meta model");
    public static final Error SERIALIZATION_FROM_STRING = new Error(247,"Error while deserializing: expecting classId @ and received @");
    public static final Error SERIALIZATION_COLLECTION = new Error(248,"Error while deserializing collection: sizes are not consistent : expected @, found @");
    public static final Error METAMODEL_READING_LAST_OBJECT = new Error(249,"Error while reading last object of @ at position @");
    public static final Error CACHE_NEGATIVE_OID = new Error(250,"Negative oid set in cache @");    
    public static final Error CLIENT_SERVER_SYNCHRONIZE_IDS = new Error(251,"Error while synchronizing oids,length are <>, local=@, client=@");
    public static final Error CLIENT_SERVER_CAN_NOT_OPEN_ODB_SERVER_ON_PORT = new Error(252,"Can not start ODB server on port @");
    public static final Error CLIENT_SERVER_CAN_NOT_ASSOCIATE_OIDS = new Error(253,"Can not associate server and client oids : server oid=@ and client oid=@");
    public static final Error SESSION_DOES_NOT_EXIST_FOR_THREAD = new Error(254,"Thread @ for base @ does not have any associated session, base id=@");
    public static final Error CLIENT_SERVER_UNKNOWN_COMMAND = new Error(255,"Unknown server command : @");
    public static final Error CLIENT_SERVER_ERROR = new Error(256,"ServerSide Error : @");
    public static final Error OBJECT_READER_DIRECT_CALL = new Error(257,"Generic readObjectInfo called for non native object info");
    public static final Error CACHE_OBJECT_INFO_HEADER_WITHOUT_CLASS_ID = new Error(258,"Object Info Header without class id ; oih.oid=@");
    public static final Error NON_NATIVE_ATTRIBUTE_STORED_BY_POSITION_INSTEAD_OF_OID = new Error(259,"Non native attribute (@) of class @ stored by position @ instead of oid");
    public static final Error CACHE_NULL_OID = new Error(260,"Null OID");
    public static final Error NEGATIVE_POSITION = new Error(261,"Negative position : @");
    public static final Error UNEXPECTED_SITUATION = new Error(262,"Unexpected situation: @");
    public static final Error IMPORT_ERROR = new Error(263,"Import error: @");
    public static final Error CLIENT_SERVER_CAN_NOT_CREATE_CLASS_INFO = new Error(264,"ServerSide Error : Can not create class info @");
    public static final Error CLIENT_SERVER_META_MODEL_INCONSISTENCY = new Error(265,"ServerSide Error : Meta model on server and client are inconsistent : class @ exist on server and does not exist on the client!");
    public static final Error CLIENT_SERVER_META_MODEL_INCONSISTENCY_DIFFERENT_OID = new Error(266,"ServerSide Error : Meta model on server and client are inconsistent : class @ have different OIDs on server (@) and client(@)!");
    public static final Error METHOD_SHOULD_NOT_BE_CALLED = new Error(267,"Method @ should not be called on @");
    public static final Error CACHE_NEGATIVE_POSITION = new Error(268,"Caching an ObjectInfoHeader with negative position @");

Current Error catalog of User Error

public static final Error CRITERIA_QUERY_UNKNOWN_ATTRIBUTE = new Error(1000, "Attribute @ used in criteria queria does not exist on class @");
    public static final Error RUNTIME_INCOMPATIBLE_VERSION = new Error(1001, "Incompatible ODB Version : ODB file version is @ and Runtime version is @");
    public static final Error INCOMPATIBLE_METAMODEL = new Error(1002, "Incompatible meta-model : @");
    public static final Error INCOMPATIBLE_JAVA_VM = new Error(1003, "Incompatible java virtual Machine, 1.4 or greater is required, you are using : @");
    public static final Error ODB_IS_CLOSED = new Error(1004, "ODB session has already been closed (@)");
    public static final Error ODB_HAS_BEEN_ROLLBACKED  = new Error(1005, "ODB session has been rollbacked (@)");
    public static final Error ODB_CAN_NOT_STORE_NULL_OBJECT  = new Error(1006, "ODB can not store null object");
    public static final Error ODB_CAN_NOT_STORE_ARRAY_DIRECTLY  = new Error(1007, "ODB can not store array directly : @");
    public static final Error ODB_CAN_NOT_STORE_NATIVE_OBJECT_DIRECTLY  = new Error(1008, "ODB can not store native object direclty : @");
    public static final Error OBJECT_DOES_NOT_EXIST_IN_CACHE_FOR_DELETE = new Error(1009, "The object being deleted does not exist in cache. Make sure the object has been loaded before deleting : @");
    public static final Error TRANSACTION_IS_PENDING = new Error(1010,"There are pending work associated to current transaction, a commit or rollback should be executed : session id = @");
    public static final Error UNKNOWN_OBJECT_TO_GET_OID = new Error(1011,"Unknown object @");
    public static final Error ODB_CAN_NOT_RETURN_OID_OF_NULL_OBJECT = new Error(1012,"Can not return the oid of a null object");
    public static final Error CACHE_IS_FULL = new Error(1013,"Cache is full! ( it has @ objects. The maximum size is @. Please increase the size of the cache using Configuration.setMaxNumberOfObjectInCache, or call the Configuration.setAutomaticallyIncreaseCacheSize(true)");
    public static final Error ODB_FILE_IS_LOCKED = new Error(1014,"@ file is locked - check if the database file is not opened in another program! : thread = @ - using multi thread ? @");
    public static final Error USER_NAME_TOO_LONG = new Error(1015,"User name @ is too long, should be lesser than 20 characters");
    public static final Error PASSWORD_TOO_LONG = new Error(1016,"Password is too long, it must be less than 20 character long");
    public static final Error TRANSACTION_ALREADY_COMMITED_OR_ROLLBACKED = new Error(1017,"Transaction have already been 'committed' or 'rollbacked'");
    public static final Error DIFFERENT_SIZE_IN_WRITE_ACTION = new Error(1018,"Size difference in WriteAction.persist :(calculated,stored)=(@,@)");
    public static final Error CLASS_WITHOUT_CONSTRUCTOR = new Error(1019,"Class without any constructor : @");
    public static final Error NO_NULLABLE_CONSTRUCTOR = new Error(1020,"Constructor @ of class @ was called with null values because it does not have default constructor and it seems the constructor is not prepared for this!");
    public static final Error QUERY_BAD_CRITERIA = new Error(1021,"CollectionSizeCriteria only work with Collection or Array, and you passed a @ instead");
    public static final Error QUERY_COLLECTION_SIZE_CRITERIA_NOT_SUPPORTED = new Error(1022,"CollectionSizeCriterion sizeType @ not yet implemented");
    public static final Error QUERY_COMPARABLE_CRITERIA_APPLIED_ON_NON_COMPARABLE = new Error(1023,"ComparisonCriteria with greater than only work with Comparable, and you passed a @ instead");
    public static final Error QUERY_UNKNOWN_OPERATOR = new Error(1024,"Unknow operator @");
    public static final Error QUERY_CONTAINS_CRITERION_TYPE_NOT_SUPPORTED = new Error(1025,"ContainsCriterion: type @ not supported!");
    public static final Error QUERY_TYPE_NOT_SUPPORTED_IN_LIKE_EXPRESSION = new Error(1026,"LikeCriteria with like expression(%) only work with String, and you passed a @ instead");
    public static final Error INDEX_KEYS_MUST_IMPLEMENT_COMPARABLE = new Error(1027,"Unable to build index key field which not Comparable : @ , value = @ - type = @");
    public static final Error INDEX_WITH_MULTIPLE_ATTRIBUTES_NOT_SUPPORTED = new Error(1028,"Index with more than one attribute not yet supported : index name = @, class name = @");
    public static final Error QUERY_NQ_MATCH_METHOD_NOT_IMPLEMENTED = new Error(1029,"ISimpleNativeQuery implementing classes must implement method: boolean match(?Object obj), class @ does not");
    public static final Error QUERY_NQ_EXCEPTION_RAISED_BY_NATIVE_QUERY_EXECUTION = new Error(1030,"Exception raised by the native query @ match method");    
    public static final Error ODB_CAN_NOT_RETURN_OID_OF_UNKNOWN_OBJECT = new Error(1031,"Can not return the oid of a not previously loaded object : @");
    public static final Error ERROR_WHILE_ADDING_OBJECT_TO_HASHMAP = new Error(1032,"Internal error in user object of class @ in equals or hashCode method : @");    
    public static final Error ATTRIBUTE_REFERENCES_A_DELETED_OBJECT = new Error(1033,"Object of type @ with oid @ has the attribute '@' that references a deleted object");    
    public static final Error BEFORE_DELETE_TRIGGER_HAS_THROWN_EXCEPTION = new Error(1034,"Before Delete Trigger @ has thrown exception. ODB has ignored it \n<user exception>\n@</user exception>");
    public static final Error AFTER_DELETE_TRIGGER_HAS_THROWN_EXCEPTION = new Error(1035,"After Delete Trigger @ has thrown exception. ODB has ignored it\n<user exception>\n@</user exception>");
    public static final Error BEFORE_UPDATE_TRIGGER_HAS_THROWN_EXCEPTION = new Error(1036,"Before Update Trigger @ has thrown exception. ODB has ignored it\n<user exception>\n@</user exception>");
    public static final Error AFTER_UPDATE_TRIGGER_HAS_THROWN_EXCEPTION = new Error(1037,"After Update Trigger @ has thrown exception. ODB has ignored it\n<user exception>\n@</user exception>");
    public static final Error BEFORE_INSERT_TRIGGER_HAS_THROWN_EXCEPTION = new Error(1038,"Before Insert Trigger @ has thrown exception. ODB has ignored it\n<user exception>\n@</user exception>");
    public static final Error AFTER_INSERT_TRIGGER_HAS_THROWN_EXCEPTION = new Error(1039,"After Insert Trigger @ has thrown exception. ODB has ignored it\n<user exception>\n@</user exception>");    
    public static final Error NO_MORE_OBJECTS_IN_COLLECTION = new Error(1040,"No more objects in collection");
    public static final Error INDEX_ALREADY_EXIST = new Error(1041,"Index @ already exist on class @");
    public static final Error INDEX_DOES_NOT_EXIST = new Error(1042,"Index @ does not exist on class @");
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License