Package org.openbravo.service.db
Class DbUtility
- java.lang.Object
-
- org.openbravo.service.db.DbUtility
-
- All Implemented Interfaces:
OBProvidable
,OBSingleton
public class DbUtility extends Object implements OBSingleton
Utility class with very general utility methods.- Author:
- mtaal
-
-
Constructor Summary
Constructors Constructor Description DbUtility()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Throwable
getUnderlyingSQLException(Throwable throwable)
This method will take care of finding the real underlying exception.static String
readFile(File file)
Reads a file and returns the content as a String.
-
-
-
Method Detail
-
getUnderlyingSQLException
public static Throwable getUnderlyingSQLException(Throwable throwable)
This method will take care of finding the real underlying exception. When a jdbc or hibernate exception occurs then the whole stack trace is not available in the log because the exception does not return the underlying exception using theThrowable.getCause()
but using theSQLException.getNextException()
.- Parameters:
throwable
- the throwable to analyze- Returns:
- the underlying sql exception or the original throwable if none found
-
readFile
public static String readFile(File file)
Reads a file and returns the content as a String. The file must exist otherwise anOBException
is thrown.- Parameters:
file
- the file to read- Returns:
- the content of the file
-
-