Package org.adempiere.exceptions
Class DBException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.adempiere.exceptions.AdempiereException
-
- org.adempiere.exceptions.DBException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DBException
public class DBException extends AdempiereException
This RuntimeException is used to pass SQLException up the chain of calling methods to determine what to do where needed.- Version:
- $Id: DBException.java,v 1.2 2006/07/30 00:54:35 jjanke Exp $
- Author:
- Vincent Harcq, Teo Sarca, SC ARHIPAC SERVICE SRL, Armen Rizal, GOODWILL CONSULTING FR [2789943] Better DBException handling for PostgreSQL https://sourceforge.net/p/adempiere/feature-requests/719/
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringDATABASE_OPERATION_TIMEOUT_MSGstatic StringDELETE_ERROR_DEPENDENT_MSGstatic StringSAVE_ERROR_NOT_UNIQUE_MSG
-
Constructor Summary
Constructors Constructor Description DBException(Exception e)Create a new DBException based on a SQLExceptionDBException(String msg)Create a new DBExceptionDBException(SQLException e, String sql)Create a new DBException based on a SQLException and SQL Query
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringgetDefaultDBExceptionMessage(Exception e)intgetErrorCode()SQLExceptiongetNextException()StringgetSQL()SQLExceptiongetSQLException()StringgetSQLState()static booleanisChildRecordFoundError(Exception e)Check if "child record found" exception (aka ORA-02292)static booleanisInvalidIdentifierError(Exception e)Check if "invalid identifier" exception (aka ORA-00904)static booleanisInvalidUserPassError(Exception e)Check if "invalid username/password" exception (aka ORA-01017)static booleanisTimeout(Exception e)Check if "time out" exception (aka ORA-01013)static booleanisUniqueContraintError(Exception e)Check if Unique Constraint Exception (aka ORA-00001)static booleanisValueTooLarge(Exception e)Check if value too large for column exception (aka ORA-12899)-
Methods inherited from class org.adempiere.exceptions.AdempiereException
getCtx, getLocalizedMessage
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Field Detail
-
DATABASE_OPERATION_TIMEOUT_MSG
public static final String DATABASE_OPERATION_TIMEOUT_MSG
- See Also:
- Constant Field Values
-
DELETE_ERROR_DEPENDENT_MSG
public static final String DELETE_ERROR_DEPENDENT_MSG
- See Also:
- Constant Field Values
-
SAVE_ERROR_NOT_UNIQUE_MSG
public static final String SAVE_ERROR_NOT_UNIQUE_MSG
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DBException
public DBException(Exception e)
Create a new DBException based on a SQLException- Parameters:
e- Specicy the Exception cause
-
DBException
public DBException(SQLException e, String sql)
Create a new DBException based on a SQLException and SQL Query- Parameters:
e- exceptionsql- sql query
-
DBException
public DBException(String msg)
Create a new DBException- Parameters:
msg- Message
-
-
Method Detail
-
getSQL
public String getSQL()
- Returns:
- SQL Query or null
-
getSQLException
public SQLException getSQLException()
- Returns:
- Wrapped SQLException or null
-
getErrorCode
public int getErrorCode()
- See Also:
SQLException.getErrorCode()
-
getNextException
public SQLException getNextException()
- See Also:
SQLException.getNextException()
-
getSQLState
public String getSQLState()
- See Also:
SQLException.getSQLState()
-
isUniqueContraintError
public static boolean isUniqueContraintError(Exception e)
Check if Unique Constraint Exception (aka ORA-00001)- Parameters:
e- exception
-
isChildRecordFoundError
public static boolean isChildRecordFoundError(Exception e)
Check if "child record found" exception (aka ORA-02292)- Parameters:
e- exception
-
isInvalidIdentifierError
public static boolean isInvalidIdentifierError(Exception e)
Check if "invalid identifier" exception (aka ORA-00904)- Parameters:
e- exception
-
isInvalidUserPassError
public static boolean isInvalidUserPassError(Exception e)
Check if "invalid username/password" exception (aka ORA-01017)- Parameters:
e- exception
-
isTimeout
public static boolean isTimeout(Exception e)
Check if "time out" exception (aka ORA-01013)- Parameters:
e-
-
isValueTooLarge
public static boolean isValueTooLarge(Exception e)
Check if value too large for column exception (aka ORA-12899)- Parameters:
e- exception
-
-